JOptionPane input focus issue
- From: "qu0ll" <qu0llSixFour@xxxxxxxxx>
- Date: Tue, 31 Oct 2006 23:20:18 +1100
I have a JOptionPane with a string and a text field as the "message" part.
It works but I would like input focus to default to the text field when the
dialog is displayed to save the user having to click into it each time. How
can I achieve this? Do I need to actually create a JOptionPane explicitly
or subclass it?
The code is as follows:
JTextField nameTextField = new JTextField();
Object[] message = {"Enter a name:", nameTextField};
int option = JOptionPane.showOptionDialog(null, message, "Enter Name",
JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, null);
--
And loving it,
qu0ll
______________________________________________
qu0llSixFour@xxxxxxxxx
(Replace the "SixFour" with numbers to email)
.
- Prev by Date: Re: Problem in displaying message while uploading file.
- Previous by thread: Re: Algorithms for JPopupMenu and Submenu creation
- Index(es):
Relevant Pages
|
|