> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]] On Behalf Of Amol Kulkarni > Sent: Wednesday, February 27, 2002 5:40 AM > To: [EMAIL PROTECTED] > Subject: Re: Problems creating internal frames with Swing > > > What is the problem here?
If I compile this code, no internal frames are appearing. Did you run that app? Steve. > > Hi List, > > > > I'm experiencing problems creating internal frames with Swing's > > JInternalFrame class. > > Maybe I misunderstood the concepts but creating internal frames > > shouldn't be that difficult. I first created an instance > of JDesktopPane > > that will contain my instance of JInternalFrame. The > internal frame is > > to be added by pressing a button, that invokes JDesktopPane's add() > > method. > > It'll be great if you could have a look at the sample code > to enlighten > > me. > > > > Thanks for your efforts, > > > > Steve. > > > > ----- code (begin) ----- > > > > import java.awt.*; > > import java.awt.event.*; > > import javax.swing.*; > > > > public class Test extends JFrame > > { > > private JDesktopPane desktopPane = new JDesktopPane(); > > private JButton button = new JButton("Create internal frame"); > > public Test() > > { > > Container contentPane = getContentPane(); > > contentPane.add(button, BorderLayout.NORTH); > > contentPane.add(desktopPane, BorderLayout.CENTER); > > desktopPane.setLayout(new FlowLayout()); > > button.addActionListener(new ActionListener() > > { > > public void actionPerformed(ActionEvent e) > > { > > JInternalFrame internalFrame = new > > JInternalFrame("Internal > > frame", true, true, true, true); > > internalFrame.setPreferredSize(new > Dimension(250, 200)); > > desktopPane.add(internalFrame); > > desktopPane.revalidate(); > > } > > }); > > } > > > > public static void main(String[] args) > > { > > JFrame frame = new Test(); > > frame.setSize(450, 400); > > frame.addWindowListener(new WindowAdapter() > > { > > public void windowClosing(WindowEvent e) > > { > > System.exit(0); > > } > > }); > > frame.show(); > > } > > } > > > > ----- code (end) ----- > > > > -- > > > > Steve Graegert <[EMAIL PROTECTED]> > > CSI Technology Group <it-csi.technologies.de> > > Berlin, Germany > > Phone: ++49.174.9456106 > > > > > ------------------------------------------------------------- > --------- > > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > > with a subject of "unsubscribe". Trouble? Contact > [EMAIL PROTECTED] > > ---------------------------------------------------------------------- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]