KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > editor > DrawContext


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.editor;
21
22 import java.awt.Color JavaDoc;
23 import java.awt.Font JavaDoc;
24
25 /** This interface provides methods for
26 * getting and setting various drawing attributes.
27 * During painting draw layer receives draw context
28 * and it is expected to either leave draw parameters
29 * as they are or change them.
30 *
31 * @author Miloslav Metelka
32 * @version 1.00
33 */

34
35
36 public interface DrawContext {
37
38     /** Get current foreground color */
39     public Color JavaDoc getForeColor();
40
41     /** Set current foreground color */
42     public void setForeColor(Color JavaDoc foreColor);
43
44     /** Get current background color */
45     public Color JavaDoc getBackColor();
46
47     /** Set current background color */
48     public void setBackColor(Color JavaDoc backColor);
49
50     /** Get current underline color */
51     public Color JavaDoc getUnderlineColor();
52
53     /** Set current underline color */
54     public void setUnderlineColor(Color JavaDoc underlineColor);
55
56     /** Get current wave underline color */
57     public Color JavaDoc getWaveUnderlineColor();
58
59     /** Set current wave underline color */
60     public void setWaveUnderlineColor(Color JavaDoc waveUnderlineColor);
61
62     /** Get current strike-through color */
63     public Color JavaDoc getStrikeThroughColor();
64
65     /** Set current underline color */
66     public void setStrikeThroughColor(Color JavaDoc strikeThroughColor);
67
68     /** Get current font */
69     public Font JavaDoc getFont();
70
71     /** Set current font */
72     public void setFont(Font JavaDoc font);
73
74     /** Get start position of the drawing. This value
75     * stays unchanged during the line-number drawing.
76     */

77     public int getStartOffset();
78
79     /** Get end position of the drawing. This value
80     * stays unchanged during the line-number drawing.
81     */

82     public int getEndOffset();
83
84     /** Is current drawing position at the begining of the line?
85     * This flag is undefined for the line-number drawing.
86     */

87     public boolean isBOL();
88
89     /** Is current drawing position at the end of the line
90     * This flag is undefined for the line-number drawing.
91     */

92     public boolean isEOL();
93
94     /** Get draw info for the component that is currently drawn. */
95     public EditorUI getEditorUI();
96
97     /** Get token type number according to the appropriate
98     * syntax scanner */

99     public TokenID getTokenID();
100
101     /** Get the token-context-path for the token */
102     public TokenContextPath getTokenContextPath();
103
104     /** Get starting position in the document of the token being drawn */
105     public int getTokenOffset();
106
107     /** Get length of the token text */
108     public int getTokenLength();
109
110     /** Get the starting position in the document of the
111      * fragment of the token being drawn.
112      */

113     public int getFragmentOffset();
114
115     /** Get the length of the fragment of the token
116      * being drawn
117      */

118     public int getFragmentLength();
119
120     /** Get the buffer with the characters being drawn. No changes can
121     * be done to characters in the buffer.
122     */

123     public char[] getBuffer();
124
125     /** Get the position in the document where the buffer starts.
126      * The area between <tt>getDrawStartOffset()</tt> and <tt>getDrawEndOffset</tt>
127      * will contain valid characters. However the first token
128      * can start even under <tt>getDrawStartOffset()</tt>. In this case
129      * the valid area starts at <tt>getTokenOffset()</tt> of the first
130      * token.
131      */

132     public int getBufferStartOffset();
133
134 }
135
Popular Tags