mausam
Posts: 243
Nickname: mausam
Registered: Sep, 2003
|
|
Re: Create dialog....
|
Posted: Sep 26, 2003 7:01 AM
|
|
JTextField tName= new JTextField(15);
JLabel lName = new JLabel("Enter the Name");
JFrame f = new JFrame("Creating PriceSheet");
f.getContentPane().setLayout(new BorderLayout());
JDialog dialog = new JDialog(f);
f.getContentPane().add(lName,BorderLayout.WEST);
f.getContentPane( ).add(tName,BorderLayout.EAST);
dialog.setContentPane(f.getContentPane());
dialog.setDefaultCloseOperation( JDialog.DO_NOTHING_ON_CLOSE);
dialog.addWindowListener(new WindowAdapter()
{public void windowClosing(WindowEvent we)
{ System.exit(0);
}
});
dialog.setSize(300,50);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
dialog.setLocation((screenSize.width - 300) / 2, (screenSize.height - 50) / 2);
dialog.setVisible(true);
//check
//I did dialog.setContentPane(f.getContentPane());
//Instead of dialog.setContentPane(f);
|
|