public class TopLevel extends Object implements ActionListener
Modifier and Type | Field and Description |
---|---|
protected JFrame |
frame
The Swing frame representing this TopLevel object.
|
Modifier | Constructor and Description |
---|---|
protected |
TopLevel(String title,
boolean exitOnClose)
A new TopLevel with the given TITLE (which window managers
typically display on the border).
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e) |
protected void |
add(Widget widget,
LayoutSpec layout)
Add WIDGET, placed according to LAYOUT.
|
protected void |
addButton(String label,
Object receiver,
String funcName,
LayoutSpec layout)
Add a new button displaying LABEL, laid out according to
LAYOUT, which when clicked calls the method named FUNCNAME of
RECEIVER with LABEL as its single String argument.
|
protected void |
addButton(String label,
String funcName,
LayoutSpec layout)
Add a new button displaying LABEL, placed according to
LAYOUT, which when clicked calls my method named FUNCNAME
with LABEL as its single String argument.
|
protected void |
addLabel(String text,
LayoutSpec layout)
Add a new, anonymous label that displays the text TEXT, placed
according to LAYOUT.
|
protected void |
addLabel(String text,
String id,
LayoutSpec layout)
Add a label that initially displays the text TEXT, placed
according to LAYOUT, and identified by the tag ID.
|
protected void |
addMenuButton(String label,
Object receiver,
String funcName)
Add a new simple menu button labeled LABEL to my menus, which
when clicked, invokes a method named FUNCNAME on RECEIVER,
sending LABEL as data.
|
protected void |
addMenuButton(String label,
String funcName)
Add a new simple menu button labeled LABEL to my menus, which
when clicked invokes a function named FUNCNAME on me,
sending LABEL as data.
|
protected void |
addMenuRadioButton(String label,
String groupName,
boolean selected,
Object receiver,
String funcName)
Add a radio button labeled LABEL to my menus, belonging to the
group of buttons called GROUPNAME.
|
protected void |
addMenuRadioButton(String label,
String groupName,
boolean selected,
String funcName)
Add a radio button labeled LABEL to my menus, belonging to the
group of buttons called GROUPNAME.
|
protected void |
addRadioButton(String label,
String groupName,
boolean selected,
Object receiver,
String funcName,
LayoutSpec layout)
Add a radio button labeled LABEL, placed according to LAYOUT,
belonging to the group of buttons called GROUPNAME.
|
protected void |
addSeparator(String label)
Add a separator to the end of the menu labeled LABEL (which
must exist) in my menu bar.
|
void |
display(boolean visible)
If VISIBLE, display this TopLevel.
|
int |
getHeight()
Return my current height in pixels.
|
String |
getTextInput(String message,
String title,
String type,
String init)
Display a dialog box with message MESSAGE and title TITLE that
prompts the user for textual input, with INIT providing the
initial value of the text.
|
int |
getWidth()
Return my current width in pixels.
|
protected boolean |
isSelected(String label)
Return true iff the button named LABEL is currently selected.
|
protected void |
select(String label,
boolean val)
Set isSelected(LABEL) to VAL, if LABEL is a valid button.
|
protected void |
setEnabled(boolean enable,
String... labels)
Set the enabled status of the buttons labeled LABELS[0], ...
|
protected void |
setLabel(String id,
String text)
Set the text of the existing label with tag ID to TEXT.
|
void |
setMaximumSize(int width,
int height)
Set my maximum size to WIDTH x HEIGHT pixels.
|
void |
setMinimumSize(int width,
int height)
Set my minimum size to WIDTH x HEIGHT pixels.
|
void |
setPreferredFocus(Widget widget)
When the focus is in my window, request that WIDGET, which should
be one of my components, get the focus.
|
void |
setPreferredSize(int width,
int height)
Set my preferred size to WIDTH x HEIGHT pixels.
|
void |
showMessage(String text,
String title,
String type)
Display the dismissable message TEXT of type TYPE in
a separate dialog window with title TITLE.
|
int |
showOptions(String message,
String title,
String type,
String deflt,
String... labels)
Display a choice of optional responses, labeled LABELS[0],...,LABELS[n]
in a separate dialog box with title TITLE and message MESSAGE.
|
protected final JFrame frame
protected TopLevel(String title, boolean exitOnClose)
public void display(boolean visible)
public void setPreferredSize(int width, int height)
public void setMinimumSize(int width, int height)
public void setMaximumSize(int width, int height)
public int getWidth()
public int getHeight()
protected void addMenuButton(String label, Object receiver, String funcName)
protected void addMenuButton(String label, String funcName)
protected void addMenuRadioButton(String label, String groupName, boolean selected, Object receiver, String funcName)
isSelected(java.lang.String)
); when the user clicks one, it
becomes selected and any other button in the group is deselected.
If FUNCNAME is non-null, the method of that name is invoked on
RECEIVER, sending LABEL as its argument.protected void addMenuRadioButton(String label, String groupName, boolean selected, String funcName)
isSelected(java.lang.String)
); when the user clicks one, it
becomes selected and any other button in the group is deselected.
If FUNCNAME is non-null, the method of that name is invoked on
RECEIVER, sending LABEL as its argument.protected void addSeparator(String label)
protected boolean isSelected(String label)
protected void select(String label, boolean val)
protected void setEnabled(boolean enable, String... labels)
protected void addButton(String label, Object receiver, String funcName, LayoutSpec layout)
protected void addButton(String label, String funcName, LayoutSpec layout)
protected void addRadioButton(String label, String groupName, boolean selected, Object receiver, String funcName, LayoutSpec layout)
isSelected(java.lang.String)
); when the
user clicks one, it becomes selected and any other button in the
group is deselected. If FUNCNAME is non-null, the method of
that name is invoked on RECEIVER, sending LABEL as its argument.protected void add(Widget widget, LayoutSpec layout)
protected void addLabel(String text, String id, LayoutSpec layout)
protected void setLabel(String id, String text)
protected void addLabel(String text, LayoutSpec layout)
public void showMessage(String text, String title, String type)
public int showOptions(String message, String title, String type, String deflt, String... labels)
public String getTextInput(String message, String title, String type, String init)
public void setPreferredFocus(Widget widget)
public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener