|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectccs.utils.FormDialog
public class FormDialog
A Form dialog is a wrapper aorund a JOptionPane.confirmDialog which implements CP-compliant keyboard handling, and a slightly terser syntax. It can be used directly; however, it may be easier to use one of the pre-packaged dialog classes instead. These all use FormDialog as an infrastructure layer.
Constructor Summary | |
---|---|
FormDialog(java.awt.Component parent,
java.lang.Object[] oa,
int iconCode,
javax.swing.JButton[] buttons,
int[] codes,
java.lang.String title)
Create a new FormDialog. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
|
static int[] |
createButtonCodeSet(int buttonsCode)
Create a set of buttons codes corresponding to the given JOptionPane code. |
static javax.swing.JButton[] |
createButtonSet(int buttonsCode)
Create a set of buttons corresponding to the given JOptionPane code. |
void |
emulateButtonPress(int idx)
Programmatically "presses" a button. |
static javax.swing.KeyStroke |
enterStroke()
Utility to make registerKeyboardAction syntax more compact. |
static javax.swing.KeyStroke |
escapeStroke()
Utility to make registerKeyboardAction syntax more compact. |
static java.awt.Font |
getTitleFont()
|
static void |
setDefaultFonts()
Asserts our default fonts. |
int |
show()
shows the dialog. |
static boolean |
show(java.awt.Component parent,
java.lang.Object content,
java.lang.String title)
Show a standard "data entry" dialog. |
static boolean |
show(java.awt.Component parent,
java.lang.Object content,
java.lang.String title,
boolean isConfirm,
int iconCode,
int buttonsCode)
Show a standard "data entry" or "message" dialog. |
static int |
showCode(java.awt.Component parent,
java.lang.Object content,
java.lang.String title,
boolean isConfirm,
int iconCode,
int buttonsCode)
Show a standard "data entry" or "message" dialog. |
static int |
when()
Utility to make registerKeyboardAction syntax more compact. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FormDialog(java.awt.Component parent, java.lang.Object[] oa, int iconCode, javax.swing.JButton[] buttons, int[] codes, java.lang.String title)
show
)
if you need maximum flexibility. However, you should generally use one of the
show
or showCode
wrapper methods. They're easier,
and more stable. Note: Killing the dialog is deemed to be equivalent to pressing
the last button in the list. Therefore, this button had better be logically
equivalent to pressing Cancel.
parent
- The Component this dangles from. If null, uses its initiative.oa
- The objects which form the body of the dialog.iconCode
- The JOptionPane
code for the icon to use.buttons
- The array of buttons to use. These can be newly-created and
not hooked up to anything; the FormDialog takes care of all that.codes
- the JOptionPane codes corresponding to the buttons
title
- The dialog box title.Method Detail |
---|
public static void setDefaultFonts()
public static java.awt.Font getTitleFont()
public int show()
show
variants,
this is not static.
public static javax.swing.KeyStroke enterStroke()
public static javax.swing.KeyStroke escapeStroke()
public static int when()
public static boolean show(java.awt.Component parent, java.lang.Object content, java.lang.String title)
parent
- The frame to dangle the dialog from. If null, it uses its initiative.content
- The object or array of objects to display.title
- The box title.
public static boolean show(java.awt.Component parent, java.lang.Object content, java.lang.String title, boolean isConfirm, int iconCode, int buttonsCode)
parent
- The frame to dangle the dialog from. If null, it uses its initiative.content
- The object or array of objects to display.title
- The box title.isConfirm
- True for a confirmDialog, false for a messageDialog.iconCode
- For a messageDialog only, the JOptionPane code for the icon.buttonsCode
- For a confirmDialog only, the JOptionPane code for which buttons
are needed.
public static int showCode(java.awt.Component parent, java.lang.Object content, java.lang.String title, boolean isConfirm, int iconCode, int buttonsCode)
content
is interpreted flexibly
as for JOptionPane and can be pretty much any object, or any array of objects,
you like!
parent
- The frame to dangle the dialog from. If null, it uses its initiative.content
- The object or array of objects to display.title
- The box title.isConfirm
- True for a confirmDialog, false for a messageDialog.iconCode
- For a messageDialog, the JOptionPane code for the icon.buttonsCode
- For a confirmDialog, the JOptionPane code for which buttons
are needed.
JOptionPane.OK_OPTION
.public static javax.swing.JButton[] createButtonSet(int buttonsCode)
public static int[] createButtonCodeSet(int buttonsCode)
public void emulateButtonPress(int idx)
idx
- The index of the button to press, in the array of buttons passed
to the constructor.public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |