All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Window
|
+----java.awt.Frame
|
+----jclass.contrib.JCDialog
JCDialog implements an OK/CANCEL dialog. By default, JCDialog is made up of a drawArea and a buttonArea containing an okButton, an applyButton and a cancelButton. These members are accessible by all.
JCDialogCB supports two callback methods. The first method is to subclass JCDialog and override the buttonCB() member function. The second methos is to implement the JCDialogCB interface and provide an implementation of the same buttonCB() member function, and then use the setButtonCB() member to register the receiver with the JCDialog class. In both cases, a return of false enables the default callback failure (usually unmapping or hiding).
Adding items to JCDialog is done through the drawArea member. It is an instance of JCOutlinePanel, and is derived from the AWT panel.
The following is an example of how to use JCDialog:
class QuitBox extends JCDialog {
public QuitBox(Frame fg) {
super(fg, "Quit Application?");
drawArea.setLayout(new JCRowColLayout(1, 1));
drawArea.add(new Label("Quit Application?"));
okButton.setLabel("Yes");
cancelButton.setLabel("No");
}
public boolean buttonCB(JCDialog d, Button b) {
if (b == okButton)
System.exit(0);
return handleEvent(new Event(this, Event.WINDOW_DESTROY, null));
}
}
In this example, the "override" technique is used. Note that the button labels are changed to "Yes" and "No".
JCDialog does not support modal dialogs.




public Button okButton
public Button applyButton
public Button cancelButton
public JCOutlinePanel drawArea
public JCOutlinePanel buttonArea

public JCDialog(Frame parent,
String title)
public JCDialog(Frame parent,
String title,
boolean apply)

public Frame getParentFrame()
public synchronized void show()
public void setButtonCB(JCDialogCB target)
public void clear()
public boolean buttonCB(JCDialog d,
Button b)
public boolean handleEvent(Event event)
All Packages Class Hierarchy This Package Previous Next Index