|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.gnu.glib.GObject | +--org.gnu.gtk.GtkObject | +--org.gnu.gtk.Widget | +--org.gnu.gtk.Container | +--org.gnu.gtk.Bin | +--org.gnu.gtk.Window | +--org.gnu.gtk.Dialog
Dialog boxes are a convenient way to prompt the user for a small amount of input, eg. to display a message, ask a question, or anything else that does not require extensive effort on the user's part.
GTK+ treats a dialog as a window split vertically. The top section is a
VBox
, and is where widgets such as a Label
or a
Entry
should be packed. The bottom area is known as the
actionArea. This is generally used for packing buttons into the
dialog which may perform functions such as cancel, ok, or apply. The two
areas are separated by a HSeparator
.
A 'modal' dialog (that is, one which freezes the rest of the application
from user input), can be created by calling Window.setModal(boolean)
on the
dialog.
If you want to block waiting for a dialog to return before returning control
flow to your code, you can call run()
. This function enters a
recursive main loop and waits for the user to respond to the dialog,
returning the response ID corresponding to the button the user clicked.
Constructor Summary | |
Dialog()
Construct a new Dialog object |
|
Dialog(int handle)
Construct a dialog using a handle to a native resource. |
Method Summary | |
void |
addButton(java.lang.String buttonText,
int responseId)
Adds a button with the given text (or a stock button if buttonText is a stock ID) and sets things up so that clicking the button will emit the "response" event with the given responseId . |
void |
addListener(DialogListener listener)
Register an object to handle dialog events. |
void |
addWidget(Widget child,
int responseId)
Adds an activatable widget to the action area of the Dialog, connecting a signal handler that will emit the "response" signal on the dialog when the widget is activated. |
HButtonBox |
getActionArea()
The lower area of the Dialog where the buttons are located is a HButtonBox. |
VBox |
getDialogLayout()
The upper area of the Dialog where widgets can be added is a VBox. |
java.lang.Class |
getEventListenerClass(java.lang.String signal)
|
GtkEventType |
getEventType(java.lang.String signal)
|
boolean |
getHasSeparator()
Access for whether the dialog has a separator. |
static Type |
getType()
Retrieve the runtime type used by the GLib library. |
void |
removeListener(DialogListener listener)
Removes a listener |
int |
run()
Blocks in a recursive main loop until the dialog either emits a response signal or is destroyed. |
void |
setDefaultResponse(int responseId)
Sets the last widget in the dialog's action area with the given responseId as the default widget for the dialog. |
void |
setHasSeparator(boolean setting)
Sets whether the dialog has a separator above the buttons. |
Methods inherited from class org.gnu.gtk.Window |
addAccelGroup, deiconify, getFocusWidget, getGravity, getPosition, getSize, getTitle, iconify, maximize, move, present, removeAccelGroup, resize, setDecorated, setDefaultSize, setDefaultWidget, setFocusWidget, setGeometryHints, setGravity, setIcon, setModal, setPosition, setResizable, setTitle, stick, unmaximize, unstick |
Methods inherited from class org.gnu.gtk.Bin |
getChild |
Methods inherited from class org.gnu.gtk.Container |
add, addListener, getBorderWidth, getResizeMode, remove, removeListener, resizeChildren, setBorderWidth, setResizeMode |
Methods inherited from class org.gnu.glib.GObject |
addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, equals, getData, getHandle, removeEventHandler, setData |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Dialog()
public Dialog(int handle)
Method Detail |
public int run()
ResponseType
to determine if a standard return value is emitted.
The developer can also set the response type when a button or widget is
added to the dialog. If the dialog is destroyed the run method will
return RESPONSE_NONE.
public void addButton(java.lang.String buttonText, int responseId)
responseId
.
buttonText
- The text string to display on the button or the
stock ID for the button.responseId
- The response ID to emit when the user clicks the
button that is to be added.public void addWidget(Widget child, int responseId)
child
- An activatable Widget to add to the dialog.responseId
- The response ID to emit when the user clicks the
widget.public void setDefaultResponse(int responseId)
responseId
- The response ID.public VBox getDialogLayout()
public HButtonBox getActionArea()
public void setHasSeparator(boolean setting)
setting
- Indicates if a separator should be added to the dialog.public boolean getHasSeparator()
public void addListener(DialogListener listener)
DialogListener
public void removeListener(DialogListener listener)
addListener(org.gnu.gtk.event.DialogListener)
public java.lang.Class getEventListenerClass(java.lang.String signal)
getEventListenerClass
in class Container
public GtkEventType getEventType(java.lang.String signal)
getEventType
in class Container
public static Type getType()
|
Please send any bug reports, comments, or suggestions for the API or documentation to java-gnome-developer@lists.sf.net | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |