|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
com.antelmann.util.gui.FormDialog<T>
public class FormDialog<T>
allows easy display and handling of forms. The FormDialog contains a given form and embedds it into a dialog adding an OK-button and a CANCEL-button. Upon pressing OK, the form will be processed by a FormValidator.
FormValidator,
Serialized Form| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JDialog |
|---|
JDialog.AccessibleJDialog |
| Nested classes/interfaces inherited from class java.awt.Dialog |
|---|
Dialog.AccessibleAWTDialog |
| Nested classes/interfaces inherited from class java.awt.Window |
|---|
Window.AccessibleAWTWindow |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
static int |
CANCEL
indicates that the CANCEL-button has been pressed |
static int |
CLOSED
indicates that the dialog has been closed w/o pressing a button |
static int |
OK
indicates that the OK-button has been pressed |
| Fields inherited from class javax.swing.JDialog |
|---|
accessibleContext, rootPane, rootPaneCheckingEnabled |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface javax.swing.WindowConstants |
|---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
FormDialog(Component parent,
String title,
JComponent container,
FormValidator<T> validator)
constructs a modal dialog using a container as a form and adding buttons for OK, CANCEL. |
|
| Method Summary | |
|---|---|
static void |
fixTabKeys(Component c)
enables the standard tab keys for focus traversal; useful for a JTextArea in a form |
Exception |
getException()
if an exception was thrown during commitFormAction(), this method returns it - or null. |
static String |
getText(JTextComponent comp)
convenience method - returns actually null if the component's length is 0 |
T |
getValue()
returns the value returned by the FormValidator on commitFormAction(). |
int |
processForm()
calls setVisible(true), processes the form and returns what button was pressed. |
| Methods inherited from class java.awt.Dialog |
|---|
addNotify, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int OK
public static final int CANCEL
public static final int CLOSED
| Constructor Detail |
|---|
public FormDialog(Component parent,
String title,
JComponent container,
FormValidator<T> validator)
parent - the component that created this dialogtitle - the title for this form dialogcontainer - the component that is representing the form that will be displayed in this dialogvalidator - a FormValidator specifying the behavior of the form upon pressing OKprocessForm()| Method Detail |
|---|
public int processForm()
setVisible(true), processes the form and returns what button was pressed.
The modal dialog stays visible until either OK was pressed and the validation went smooth, or
if CANCEL was pressed. Last, the dialog may also have been closed w/o a button.
public static String getText(JTextComponent comp)
public T getValue()
FormValidator on commitFormAction().
If the cancel-button was pressed, this method always returns null.
FormValidator.commitFormAction(JComponent)public Exception getException()
commitFormAction(), this method returns it - or null.
In case an exception was thrown, it will have already been displayed to the user.
FormValidator.commitFormAction(JComponent)public static void fixTabKeys(Component c)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||