public class BasicGraphicsUtils extends Object
| Constructor and Description |
|---|
BasicGraphicsUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
drawBezel(Graphics g,
int x,
int y,
int w,
int h,
boolean isPressed,
boolean isDefault,
Color shadow,
Color darkShadow,
Color highlight,
Color lightHighlight)
Draws a bezel.
|
static void |
drawDashedRect(Graphics g,
int x,
int y,
int width,
int height)
Draws dashed rectangle.
|
static void |
drawEtchedRect(Graphics g,
int x,
int y,
int w,
int h,
Color shadow,
Color darkShadow,
Color highlight,
Color lightHighlight)
Draws an etched rectangle.
|
static void |
drawGroove(Graphics g,
int x,
int y,
int w,
int h,
Color shadow,
Color highlight)
Draws a groove.
|
static void |
drawLoweredBezel(Graphics g,
int x,
int y,
int w,
int h,
Color shadow,
Color darkShadow,
Color highlight,
Color lightHighlight)
Draws a lowered bezel.
|
static void |
drawString(Graphics g,
String text,
int underlinedChar,
int x,
int y)
Draw a string with the graphics
g at location (x,y)
just like g.drawString would. |
static void |
drawStringUnderlineCharAt(Graphics g,
String text,
int underlinedIndex,
int x,
int y)
Draw a string with the graphics
g at location
(x, y)
just like g.drawString would. |
static Insets |
getEtchedInsets()
Returns the amount of space taken up by a border drawn by
drawEtchedRect() |
static Insets |
getGrooveInsets()
Returns the amount of space taken up by a border drawn by
drawGroove() |
static Dimension |
getPreferredButtonSize(AbstractButton b,
int textIconGap)
Returns the preferred size of the button.
|
public static void drawEtchedRect(Graphics g, int x, int y, int w, int h, Color shadow, Color darkShadow, Color highlight, Color lightHighlight)
g - an instance of Graphicsx - an X coordinatey - an Y coordinatew - a widthh - a heightshadow - a color of shadowdarkShadow - a color of dark shadowhighlight - a color highlightinglightHighlight - a color of light highlightingpublic static Insets getEtchedInsets()
drawEtchedRect()public static void drawGroove(Graphics g, int x, int y, int w, int h, Color shadow, Color highlight)
g - an instance of Graphicsx - an X coordinatey - an Y coordinatew - a widthh - a heightshadow - a color of shadowhighlight - a color highlightingpublic static Insets getGrooveInsets()
drawGroove()public static void drawBezel(Graphics g, int x, int y, int w, int h, boolean isPressed, boolean isDefault, Color shadow, Color darkShadow, Color highlight, Color lightHighlight)
g - an instance of Graphicsx - an X coordinatey - an Y coordinatew - a widthh - a heightisPressed - is component pressedisDefault - is default drawingshadow - a color of shadowdarkShadow - a color of dark shadowhighlight - a color highlightinglightHighlight - a color of light highlightingpublic static void drawLoweredBezel(Graphics g, int x, int y, int w, int h, Color shadow, Color darkShadow, Color highlight, Color lightHighlight)
g - an instance of Graphicsx - an X coordinatey - an Y coordinatew - a widthh - a heightshadow - a color of shadowdarkShadow - a color of dark shadowhighlight - a color highlightinglightHighlight - a color of light highlightingpublic static void drawString(Graphics g, String text, int underlinedChar, int x, int y)
g at location (x,y)
just like g.drawString would. The first occurrence
of underlineChar in text will be underlined.
The matching algorithm is not case sensitive.g - an instance of Graphicstext - a textunderlinedChar - an underlined charx - an X coordinatey - an Y coordinatepublic static void drawStringUnderlineCharAt(Graphics g, String text, int underlinedIndex, int x, int y)
g at location
(x, y)
just like g.drawString would.
The character at index underlinedIndex
in text will be underlined. If index is beyond the
bounds of text (including < 0), nothing will be
underlined.g - Graphics to draw withtext - String to drawunderlinedIndex - Index of character in text to underlinex - x coordinate to draw aty - y coordinate to draw atpublic static void drawDashedRect(Graphics g, int x, int y, int width, int height)
g - an instance of Graphicsx - an X coordinatey - an Y coordinatewidth - a width of rectangleheight - a height of rectanglepublic static Dimension getPreferredButtonSize(AbstractButton b, int textIconGap)
b - an instance of AbstractButtontextIconGap - a gap between text and icon Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2016, Oracle and/or its affiliates. All rights reserved.
DRAFT 9-internal+0-2016-01-26-133437.ivan.openjdk9onspinwait