Java Reference
In-Depth Information
30.
return (caseSensitive);
31.
}
32.
33.
public boolean getSearch()
34.
{
35.
return (search);
36.
}
37. }
12.6
Predefined option dialogues
For a number of simple but frequently used dialogues, Swing offers predefined
components. Messages such as 'File Win.ini has been deleted' and questions such
as 'Format hard disk? Yes/No' are examples. The Swing class JOptionPane supplies
methods for making such simple dialogues appear. The following most frequently
used ones are: showMessageDialog , showConfirmDialog and showOptionDia-
log .
We use such a dialogue-amessage dialogue - to display the result of our
search:
JOptionPane.showMessageDialog(Component parent,
String title,
String message,
int type);
As for other kinds of dialogue, the parent component is blocked while the mes-
sage is visible. The text title appears in the title bar of the dialogue. The text
message is shown in the dialogue. Argument type determines which symbol (e.g.
warning sign, exclamation mark) is shown next to the message. There are prede-
fined constants in ' JOptionPane '. Figure 12.3 shows the result. This completes our
editor. The editor also needs the classes SearchDialog and InfoTransferObject
defined in Section 12.5. The whole program is found on the home page of the
topic.
Figure 12.3 The dialogue used to display the search result
Search WWH ::




Custom Search