This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

modal in jdk1.3 & Win2000  RSS feed

 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I had posted this question earlier..Im using JDK 1.3 & Im trying to make a JOptionPane modal by extending JDialog, it was shown as modal in JDK 1.2 , but the moment I tested in JDK 1.3 it doesnt show as modal, any ideas?
here's my code..
private int showDialog(JOptionPane pane , String title)
{
JDialog dialog = pane.createDialog(japplet, title);
dialog.setModal(true);
dialog.setResizable(false);
dialog.show();
......
}// EOF showDialog()
I received this response "JOptionPane has built-in methods to handle this. Have you tried using JOptionPane.showMessageDialog()? Dialogs built in this way are modal by default."

But it still doesnt remain modal in JDK1.3 & on a Win2000 machine..so any suggestions?
Vinod
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The reply given to u is perfect cause it works for me. The code below is the one i have used and it is modal by default. I have not set it explicitly and i use jdk1.3.
JOptionPane noserver=new JOptionPane();
noserver.setFont(new Font("Serif", Font.BOLD, 14));
noserver.showMessageDialog(null,"Server not Available.","",noserver.ERROR_MESSAGE);
System.exit(0);
why don't u install jdk1.3 again.
Good luck,
Preethi
 
Vinod Venugopal
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Preethi,
I tried ur piece of code & still it doesnt remain modal, i can still open multiple windows..here is the code..any ideas?
public class ModalTest extends JApplet implements ActionListener
{
public JPanel mainPanel;
public boolean dialogActive = false;
public void init()
{
mainPanel = new JPanel();
JButton dialogB = new JButton("Dialog");
mainPanel.setLayout(new FlowLayout());
mainPanel.add(dialogB);
dialogB.addActionListener(this);
getContentPane().add(mainPanel);

}
public void actionPerformed(ActionEvent ev)
{
showDialog(mainPanel,"Add New");

}

private void showDialog(Component panel , String title)
{
JOptionPane pane = new JOptionPane();

pane.showMessageDialog(null,"Server not Available.","",pane.ERROR_MESSAGE);
}// EOF method showDialog(Component,String)
}//eof class ModalTest{}
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!