Need help.

The problem is Internal Frames do show up properly.

I have extended JDesktopPane and i "add" it to JFrame's contentPane. My 
extended class MyDesktopPane is added 2 JPanels. And one of them has a button 
(and the class is the listener for its actions) to display an internal frame.

//class defination:
 
class MyDesktopPane extends JDesktopPane implements ActionListener {}

The code when run as a standalone, just adding the MyDesktopPane to the 
contentPane directly in the main by saying :

// method of MyDesktopPane
public static void main(String args[]){
        JFrame f = new JFrame();
        f.setVisible(true);
        f.getContentPane().add(new MyDesktopPane());
        f.setExtendedState(JFrame.MAXIMIZED_BOTH);
}

works well and displays the Internal Frame properly as desired.

the code written for the buttons actionListener is as follows:


// method of MyDesktopPane
public void actionPerformed(ActionEvent ae){
                if(ae.getActionCommand().equals("VITAL DATA")){
                        if(internalWindow==null){
                                createInternalWindow();
                        }
                        internalWindow.setVisible(true);
                }
}


I construct the Internal Frame when  the button is clicked:

// method of MyDesktopPane
public void createInternalWindow(){
                internalWindow         = new JInternalFrame("Vital Data!!",
                                                    false,  //resizable
                                                    false, //not closable
                                                    false, //not maximizable
                                                    false); //iconifiable

                //vdp is constructed in constructor of MyDesktopPane()

                internalWindow.setContentPane(vdp);
                internalWindow.setPreferredSize(vdp.getPreferredSize());
                
                add(internalWindow);

//              this panel is added directly to the JDesktopPane as the class 
extends the JDesktopPane
}


But when i do this using a menu driven JFrame it doesn't though method adopted 
is the same.

What has gone wrong in programming. Please help.

Shomal

_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to