focus with multiple JOptionPane.showInputDialog calls

  • Thread starter Joseph M. DeAngelo
  • Start date
J

Joseph M. DeAngelo

This must be simple but I can't get it. I have a simple standalone
java program that tries to issue more than one input request from a
Windows user. Here's the source:

import javax.swing.*;

public class focus
{
public static void main(String [] args)
{
String line;
JOptionPane pane ;

pane = new JOptionPane();
line = pane.showInputDialog("Prompt1");
line = pane.showInputDialog("Prompt2");

System.exit(0);

}
}

The first prompt brings up a dialog box that has keyboard input focus.
If I type in some data and hit enter, the 2nd input dialog comes up
but does not have the input focus. Is there any way to avoid having
to tap the mouse button?
I'm not a java programmer and am just trying to help someone else thru
a programing course.

Thanks....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top