|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.javaranch.common.AWT | +--com.javaranch.common.GUI
Contains a collection of static methods related to GUI's (AWT and Swing stuff).
- - - - - - - - - - - - - - - - -
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 |
Fields inherited from class com.javaranch.common.AWT |
center, right, rightPad |
Method Summary | |
static javax.swing.JMenuItem |
addMenuItem(javax.swing.JComponent m,
javax.swing.JMenuItem mi,
java.awt.event.ActionListener listener)
A convenience function that adds an ActionListener to a JMenuItem and adds the item to a JMenu. |
static javax.swing.JMenuItem |
addMenuItem(javax.swing.JComponent m,
java.lang.String desc)
A convenience method that makes a JMenuItem out of some text and adds that to a JMenu. |
static javax.swing.JMenuItem |
addMenuItem(javax.swing.JComponent m,
java.lang.String desc,
java.awt.event.ActionListener listener)
A convenience method that makes a JMenuItem out of some text, adds an ActionListener and adds the result to a JMenu. |
static void |
blur(java.awt.image.BufferedImage i)
|
static javax.swing.JButton |
button(java.lang.String text,
int x,
int y,
java.awt.Font font,
java.awt.FontMetrics metrics)
|
static javax.swing.JButton |
button(java.lang.String text,
int x,
int y,
int width,
int height)
|
static javax.swing.JCheckBox |
checkBox(int x,
int y,
int width,
int height)
|
static java.awt.image.BufferedImage |
createBeveledImage(int width,
int height,
java.awt.Color color,
java.awt.Color topColor,
java.awt.Color rightColor,
java.awt.Color bottomColor,
java.awt.Color leftColor,
int borderThickness)
Create an image that looks like a beveled rectangle. |
static java.awt.image.BufferedImage |
createBeveledImage(int width,
int height,
java.awt.Color color,
int borderThickness)
|
static java.awt.Color |
darken(java.awt.Color c,
double factor)
|
static void |
errorDialog(java.awt.Frame f,
java.lang.String message)
|
static javax.swing.JLabel |
label(java.lang.String text,
int x,
int y,
java.awt.Font font,
java.awt.FontMetrics metrics)
Creates a label with the correct size for the provided FontMetric. |
static javax.swing.JLabel |
label(java.lang.String text,
int x,
int y,
int width,
int height)
|
static java.awt.Color |
lighten(java.awt.Color c,
double factor)
|
static void |
messageDialog(java.awt.Frame f,
java.lang.String message)
|
static java.awt.Image |
softBeveledImage(int width,
int height,
java.awt.Color color,
int borderThickness)
|
static javax.swing.JTextField |
textField(int columns,
int x,
int y,
int width,
int height)
|
static void |
warningDialog(java.awt.Frame f,
java.lang.String message)
|
Methods inherited from class com.javaranch.common.AWT |
ascent, blank, center, drawBeveledRect, drawBeveledRect, drawBeveledRect, FontHeight, gbc, gbc, getFrame, getSize, shrink, tellUser |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static java.awt.image.BufferedImage createBeveledImage(int width, int height, java.awt.Color color, java.awt.Color topColor, java.awt.Color rightColor, java.awt.Color bottomColor, java.awt.Color leftColor, int borderThickness)
Good for making panels and buttons.
width
- The width of the image. height
- The height of the image. color
- The color of all that stuff in the middle of the image. 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 java.awt.Color darken(java.awt.Color c, double factor)
public static java.awt.Color lighten(java.awt.Color c, double factor)
public static java.awt.image.BufferedImage createBeveledImage(int width, int height, java.awt.Color color, int borderThickness)
public static java.awt.Image softBeveledImage(int width, int height, java.awt.Color color, int borderThickness)
public static void blur(java.awt.image.BufferedImage i)
public static javax.swing.JMenuItem addMenuItem(javax.swing.JComponent m, java.lang.String desc)
m
- A JMenu object to add the new JMenuItem to. desc
- The text of the new menu item.
public static javax.swing.JMenuItem addMenuItem(javax.swing.JComponent m, java.lang.String desc, java.awt.event.ActionListener listener)
m
- A JMenu object to add the new JMenuItem to. desc
- The text of the new menu item. listener
- The action listener that will want to be notified when this item is selected.
public static javax.swing.JMenuItem addMenuItem(javax.swing.JComponent m, javax.swing.JMenuItem mi, java.awt.event.ActionListener listener)
m
- A JMenu object to add the JMenuItem to. mi
- The JMenuItem. listener
- The action listener that will want to be notified when this item is selected.
public static javax.swing.JLabel label(java.lang.String text, int x, int y, int width, int height)
public static javax.swing.JLabel label(java.lang.String text, int x, int y, java.awt.Font font, java.awt.FontMetrics metrics)
public static javax.swing.JTextField textField(int columns, int x, int y, int width, int height)
public static javax.swing.JButton button(java.lang.String text, int x, int y, int width, int height)
public static javax.swing.JButton button(java.lang.String text, int x, int y, java.awt.Font font, java.awt.FontMetrics metrics)
public static javax.swing.JCheckBox checkBox(int x, int y, int width, int height)
public static void messageDialog(java.awt.Frame f, java.lang.String message)
public static void warningDialog(java.awt.Frame f, java.lang.String message)
public static void errorDialog(java.awt.Frame f, java.lang.String message)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |