Reputation: 410
it means when I click a button in my JFrame, a JDialog will be shown.I want to ban my JFrame, it won't be touch but still be shown on screen. I use command in my frame:
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
MyDialog md=new MyDialog(MyFrame.this);
MyDialog.setVisible(true);
}
});
And in class MyDialog extends JDialog:
public MyDialog(MyGUI myGUI) {
super(myGUI,true);}
Have something wrong in my code? or Have another way to make it? Please help me!!
Upvotes: 0
Views: 664
Reputation: 410
I found my case. I used to some setting for JDialog, and two of them is :
Container con= getContentPane();
con.add(p);
sorry everybody for my pool JAVA. I'm a beginning and I'm trying to increase my knowlegde. Thank you very much!
Upvotes: 0
Reputation: 520
Add this before MyDialog.setVisible(true);
:
MyDialog.setModal(true);
EDIT:
This has the same effect as the JDialog(Frame owner, boolean modal)
constructor that you are already using. Are you sure you aren't already getting a modal dialog?
Upvotes: 2