• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to set JOptionPane to Close instead of hide ?

 
Tomer Gal
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String name = JOptionPane.showInputDialog("Please enter the i.p address of the server.") ;

Can anyone tell me how do I set its default close operation to close instead of hide?

Thanks to those who help in advanced guys
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like you have a program that uses JOptionPanes for input/output,
and at the end, java is still listed as 'running' in your task manager.

if so, because JOptionPanes use javaw.exe, you need to include a System.exit(0);
at the end of the program.
 
Tomer Gal
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
System.exit(0) will exit my program and thats not something that I'd like to do but its allright... I already managed to solve the problem

void getServerIp() {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
ipserver = JOptionPane.showInputDialog( frame,
"Please enter the i.p address of the server.") ;
frame.dispose();
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!