|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.javaranch.common.AWT
contains a collection of static methods related to GUI's (AWT only).
- - - - - - - - - - - - - - - - -
Copyright (c) 1998-2004 Paul Wheaton
You are welcome to do whatever you want to with this source file provided that you maintain this comment fragment (between the dashed lines). Modify it, change the package name, change the class name ... personal or business use ... sell it, share it ... add a copyright for the portions you add ...
My goal in giving this away and maintaining the copyright is to hopefully direct developers back to JavaRanch.
The original source can be found at JavaRanch
- - - - - - - - - - - - - - - - -
Field Summary | |
static int |
center
|
static int |
right
|
static int |
rightPad
|
Method Summary | |
static int |
ascent(java.awt.Component c)
Get the ascent associated with the font used by a component. |
static java.awt.Button |
blank()
Returns an object that can be used for whitespace in GridLayout. |
static void |
center(java.awt.Component c)
Center any GUI object on the screen. |
static IRect |
drawBeveledRect(java.awt.Graphics g,
IRect r,
java.awt.Color topColor,
java.awt.Color rightColor,
java.awt.Color bottomColor,
java.awt.Color leftColor,
int borderThickness)
Draw a beveled rectangle. |
static java.awt.Rectangle |
drawBeveledRect(java.awt.Graphics g,
java.awt.Rectangle r,
int thickness,
boolean outtie)
Draw a beveled rectangle and assumes the color of gray. |
static java.awt.Rectangle |
drawBeveledRect(java.awt.Graphics g,
java.awt.Rectangle r,
int Thickness,
boolean Outtie,
java.awt.Color c)
Draw a beveled rectangle. |
static int |
FontHeight(java.awt.Component c)
Get the height associated with the font used by a component. |
static java.awt.GridBagConstraints |
gbc(int x,
int y)
For creating quick GridBagConstraints objects. |
static java.awt.GridBagConstraints |
gbc(int x,
int y,
int wide,
int high,
double weightx,
double weighty)
For creating quick GridBagConstraints objects. |
static java.awt.Frame |
getFrame(java.awt.Component c)
Given any component, find the closest parent frame. |
static java.awt.Dimension |
getSize(java.awt.Font f,
java.lang.String s)
|
static java.awt.Rectangle |
shrink(java.awt.Rectangle r)
Get a rectangle that fits perfectly within another rectangle. |
static void |
tellUser(java.awt.Component c,
java.lang.String s)
Pop up a dialog to pass a message to the user. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int center
public static final int right
public static final int rightPad
Method Detail |
public static java.awt.GridBagConstraints gbc(int x, int y, int wide, int high, double weightx, double weighty)
public static java.awt.GridBagConstraints gbc(int x, int y)
public static java.awt.Button blank()
public static java.awt.Frame getFrame(java.awt.Component c)
c
- Any AWT or Swing component.
public static void tellUser(java.awt.Component c, java.lang.String s)
c
- Any component. s
- The message. public static void center(java.awt.Component c)
c
- The component to be centered. public static java.awt.Rectangle shrink(java.awt.Rectangle r)
r
- The rectangle that the new rectangle will fit inside of.
public static java.awt.Rectangle drawBeveledRect(java.awt.Graphics g, java.awt.Rectangle r, int Thickness, boolean Outtie, java.awt.Color c)
g
- A Graphics object that will be drawn on.r
- The rectangle that defines the outermost edge of the beveled rectangle.Thickness
- How many lines thick should this beveled rectangle be?Outtie
- Should the bevel be made to look like a button sticking out (true) or an indent in the canvas (false).
public static java.awt.Rectangle drawBeveledRect(java.awt.Graphics g, java.awt.Rectangle r, int thickness, boolean outtie)
g
- A Graphics object that will be drawn on.r
- The rectangle that defines the outermost edge of the beveled rectangle.thickness
- How many lines thick should this beveled rectangle be?outtie
- Should the bevel be made to look like a button sticking out (true) or an indent in the canvas (false).
public static IRect drawBeveledRect(java.awt.Graphics g, IRect r, java.awt.Color topColor, java.awt.Color rightColor, java.awt.Color bottomColor, java.awt.Color leftColor, int borderThickness)
g
- A Graphics object that will be drawn on.r
- The rectangle that defines the outermost edge of the beveled rectangle.topColor
- The color to be used on the top edge. rightColor
- The color to be used on the right edge. bottomColor
- The color to be used on the bottom edge. leftColor
- The color to be used on the left edge. borderThickness
- How many lines thick should this beveled rectangle be?
public static int ascent(java.awt.Component c)
public static int FontHeight(java.awt.Component c)
public static java.awt.Dimension getSize(java.awt.Font f, java.lang.String s)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |