Hi All
We tried to implement modal forms by using JDialog. However we have notice
that when we using "setResizable(false)" we couldn't show image icon on
Dialog title bar.
When we commented out "setResizable(false)" it appeared. 
How we can overcome this, because we need not to allow user to resize the
dialog.
Please advice us.
Please find the sample code below for your reference.

BR
Senaka



//Frame1.java

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class Frame1 extends JFrame {
    JButton jButton1 = new JButton();

    public Frame1() {
        try {
            jbInit();
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }
    public static void main(String[] args) {
        Frame1 frame1 = new Frame1();
        frame1.setSize(500, 500);
        frame1.setVisible(true);
    }
    private void jbInit() throws Exception {
        jButton1.setBounds(new Rectangle(102, 126, 160, 36));
        jButton1.setText("jButton1");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(ActionEvent e) {
                jButton1_actionPerformed(e);
            }
        });
 
this.setIconImage(Toolkit.getDefaultToolkit().createImage("images/test.gif")
);
        this.getContentPane().setLayout(null);
        this.getContentPane().add(jButton1, null);
    }

    void jButton1_actionPerformed(ActionEvent e) {
        new Dialog1(this, "Test Dialog", true).setVisible(true);
    }
}



//Dialog1.java

import java.awt.*;
import javax.swing.*;

public class Dialog1 extends JDialog {
    JPanel panel1 = new JPanel();
    BorderLayout borderLayout1 = new BorderLayout();

    public Dialog1(Frame frame, String title, boolean modal) {
        super(frame, title, modal);
        try {
            jbInit();
        }
        catch(Exception ex) {
            ex.printStackTrace();
        }
    }

    public Dialog1() {
        this(null, "", false);
    }
    void jbInit() throws Exception {
        panel1.setLayout(borderLayout1);
        getContentPane().add(panel1);
        this.setSize(200, 200);
        this.setResizable(false);
    }
}
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to