| org.netbeans.editor.DrawGraphics
DrawGraphics | interface DrawGraphics (Code) | | Draw graphics functions as abstraction over various kinds of drawing. It's
used for drawing into classic graphics, printing and measuring. Generally
there are only the setters for some properties because the draw-engine
doesn't retrieve the values that it previously set.
author: Miloslav Metelka version: 1.00 |
Inner Class :abstract static class AbstractDG implements DrawGraphics | |
Inner Class :static class SimpleDG extends AbstractDG | |
Inner Class :final static class GraphicsDG extends SimpleDG | |
Inner Class :final static class PrintDG extends SimpleDG | |
Method Summary | |
public void | drawChars(int offset, int length, int width, Color strikeThroughColor, Color underlineColor) Draw characters from the specified offset in the buffer
Parameters: offset - offset in the buffer for drawn text; if the text containstabs, then offset is set to -1 and length contains the countof the space characters that correspond to the expanded tabs Parameters: length - length of the text being drawn Parameters: width - width of the text being drawn in points. | public void | drawTabs(int offset, int length, int spaceCount, int width, Color strikeThroughColor, Color underlineColor) Draw the expanded tab characters.
Parameters: offset - offset in the buffer where the tab characters start. Parameters: length - number of the tab characters Parameters: spaceCount - number of spaces that replace the tabs Parameters: width - width of the spaces in points. | public void | eol() EOL encountered and should be handled. | public void | fillRect(int width) Fill rectangle at the current [x, y] with the current background color.
Parameters: width - width of the rectangle to fill in points. | public void | finish() Called when whole drawing ends. | public Graphics | getGraphics() Get the AWT-graphics to determine whether this draws to a graphics. | public void | init(DrawContext ctx) | public void | setBackColor(Color backColor) | public void | setBuffer(char[] buffer) Set character buffer from which the characters are drawn. | public void | setDefaultBackColor(Color defaultBackColor) Inform the draw-graphics about the current background color of the
component. | public void | setFont(Font font) | public void | setForeColor(Color foreColor) | public void | setLineAscent(int lineAscent) Set the ascent of the line. | public void | setLineHeight(int lineHeight) Set the height of the line. | public void | setX(int x) | public void | setY(int y) | public boolean | supportsLineNumbers() Whether draw graphics supports displaying of line numbers. | public boolean | targetOffsetReached(int offset, char ch, int x, int charWidth, DrawContext ctx) This method is called to notify this draw graphics in response from
targetPos parameter passed to draw().
Parameters: offset - position that was reached during the drawing. Parameters: ch - character at offset Parameters: charWidth - visual width of the character ch Parameters: ctx - current draw context containing whether the drawing should continue or not. |
drawChars | public void drawChars(int offset, int length, int width, Color strikeThroughColor, Color underlineColor)(Code) | | Draw characters from the specified offset in the buffer
Parameters: offset - offset in the buffer for drawn text; if the text containstabs, then offset is set to -1 and length contains the countof the space characters that correspond to the expanded tabs Parameters: length - length of the text being drawn Parameters: width - width of the text being drawn in points. The currentx-coordinate must be increased by width automatically. Parameters: strikeThroughColor - color to be used for strike-through or null if thestrike-through shouldn't be done. Parameters: underlineColor - color to be used for underlining or null if the underliningshouldn't be done. |
drawTabs | public void drawTabs(int offset, int length, int spaceCount, int width, Color strikeThroughColor, Color underlineColor)(Code) | | Draw the expanded tab characters.
Parameters: offset - offset in the buffer where the tab characters start. Parameters: length - number of the tab characters Parameters: spaceCount - number of spaces that replace the tabs Parameters: width - width of the spaces in points. The current x-coordinate mustbe increased by width automatically. Parameters: strikeThroughColor - color to be used for strike-through or null if thestrike-through shouldn't be done. Parameters: underlineColor - color to be used for underlining or null if the underliningshouldn't be done. |
eol | public void eol()(Code) | | EOL encountered and should be handled.
|
fillRect | public void fillRect(int width)(Code) | | Fill rectangle at the current [x, y] with the current background color.
Parameters: width - width of the rectangle to fill in points. The currentx-coordinate must be increased by width automatically. |
finish | public void finish()(Code) | | Called when whole drawing ends. Can be used to deallocate some resources
etc.
|
getGraphics | public Graphics getGraphics()(Code) | | Get the AWT-graphics to determine whether this draws to a graphics. This
is useful for fast line numbering and others.
|
init | public void init(DrawContext ctx)(Code) | | Initialize this draw graphics before drawing
|
setBackColor | public void setBackColor(Color backColor)(Code) | | Set background color
|
setBuffer | public void setBuffer(char[] buffer)(Code) | | Set character buffer from which the characters are drawn.
|
setDefaultBackColor | public void setDefaultBackColor(Color defaultBackColor)(Code) | | Inform the draw-graphics about the current background color of the
component.
|
setFont | public void setFont(Font font)(Code) | | Set current font
|
setForeColor | public void setForeColor(Color foreColor)(Code) | | Set foreground color
|
setLineAscent | public void setLineAscent(int lineAscent)(Code) | | Set the ascent of the line.
|
setLineHeight | public void setLineHeight(int lineHeight)(Code) | | Set the height of the line.
|
setX | public void setX(int x)(Code) | | Set the current x-coordinate
|
setY | public void setY(int y)(Code) | | Set the current y-coordinate
|
supportsLineNumbers | public boolean supportsLineNumbers()(Code) | | Whether draw graphics supports displaying of line numbers. If not line
number displaying is not done.
|
targetOffsetReached | public boolean targetOffsetReached(int offset, char ch, int x, int charWidth, DrawContext ctx)(Code) | | This method is called to notify this draw graphics in response from
targetPos parameter passed to draw().
Parameters: offset - position that was reached during the drawing. Parameters: ch - character at offset Parameters: charWidth - visual width of the character ch Parameters: ctx - current draw context containing whether the drawing should continue or not. If it returns falseit's guaranteed that this method will not be called again and thewhole draw() method will be stopped. The only exception is when the -1 is used as the target offsetwhen draw() is called which means that every offset is apotential target offset and must be checked. In this case thebinary search is used when finding the target offset insidepainted fragment. That greatly improves performance for longfragments because the font metrics measurements are relativelyexpensive. |
|
|