I'm using Sun's JDK 1.3.1 for Windows and Compaq's JDK 1.3.1-1 for Alpha Linux. There are no problems with Linux but Windows doesn't like my code. I started debugging under Windows and realized that the instance of JInternalFrame is created and JDesktopPane's add() method is invoked, but with no result. Any ideas?
Thanks, Steve. > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]] On Behalf Of Amol Kulkarni > Sent: Wednesday, February 27, 2002 10:45 AM > To: [EMAIL PROTECTED] > Subject: Re: Problems creating internal frames with Swing > > > Yes Steve, I compiled and ran it. Internal frames appeared > properly. What > platform n jdk r u using > Steve Graegert wrote: > > > > -----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] > ---------------------------------------------------------------------- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]