public class OpenReportDialog extends JDialog {
public OpenReportDialog(JFrame owner)
{
super(owner);
setLayout(new BorderLayout());
setTitle("Select Directories");
setModal(true);
setResizable(false);
...
mainFrame=new JFrame();
mainFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
mainFrame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e)
{
closeApplication();
}
});
try{
mainFrame.setIconImage(new ImageIcon(ClassLoader.getSystemResource("pictures/icon.png")).getImage());
}
catch(Exception e)
{
e.printStackTrace();
}
....
mainFrame.setVisible(true);
OpenReportDialog ord=new OpenReportDialog(mainFrame);
import javax.swing.JDialog;
import javax.swing.JFrame;
public class CallFrame extends JFrame {
public CallFrame()
{
setTitle("Frame");
setSize(200,200);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
JDialog dialog=new JDialog(this);
dialog.setTitle("Dialog");
dialog.setResizable(false); // bei true hats ein icon, bei false nicht !!!
dialog.setSize(100,100);
dialog.setLocationRelativeTo(this);
dialog.setVisible(true);
}
public static void main(String args[])
{
CallFrame cf=new CallFrame();
}
}