aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Sory, now I putted the code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Sory, now I putted the code" Watch "Sory, now I putted the code" New topic
Author

Sory, now I putted the code

Mihalache Catalin
Greenhorn

Joined: Sep 01, 2003
Posts: 7
This is the code:

import java.awt.event.*;
import javax.swing.*;
public class myDialog extends JDialog {
/** Creates a new instance of myDialog */
public myDialog(){
setModal(true);
setTitle("Some data into a dialog window");
getContentPane().setLayout(null);
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
JButton btnOpenJFrame = new JButton("Open a JFrame()");
btnOpenJFrame.setSize(300, 25);
getContentPane().add(btnOpenJFrame);
btnOpenJFrame.setLocation(30, 30);

pack();
setLocation(10, 10);
setSize(400, 300);
setResizable(false);

addWindowListener(
new WindowAdapter(){
public void windowClosing(WindowEvent e){
myDialog.this.dispose();
System.exit(0);
}
}
);

btnOpenJFrame.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
JFrame myJFrame = new JFrame(
"Here I perform some edit operations");
myJFrame.setDefaultCloseOperation(
JFrame.DISPOSE_ON_CLOSE);
myJFrame.setSize(600, 500);
myJFrame.setLocation(10, 10);
myJFrame.show();
myJFrame.requestFocus();
}
}
);

}

/** Main entry point */
public static void main(String args[]){
new myDialog().show();
}
}
When I push the button it will appear a frame but I cannot use it!
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
Your dialog is modal. Change it to modal=false.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Sory, now I putted the code