File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes modal in jdk1.3 & Win2000 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "modal in jdk1.3 & Win2000" Watch "modal in jdk1.3 & Win2000" New topic

modal in jdk1.3 & Win2000

Vinod Venugopal
Ranch Hand

Joined: Dec 06, 2000
Posts: 148
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);
}// 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 any suggestions?

- Vinod<br />-------<br />SCJP2
Preethi Mohan

Joined: Dec 09, 2000
Posts: 4
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);
why don't u install jdk1.3 again.
Good luck,
Vinod Venugopal
Ranch Hand

Joined: Dec 06, 2000
Posts: 148
Hello Preethi,
I tried ur piece of code & still it doesnt remain modal, i can still open multiple 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());

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{}
I agree. Here's the link:
subject: modal in jdk1.3 & Win2000
It's not a secret anymore!