Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.alt.net!news-out.readnews.com!news-xxxfer.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail From: "Jeff Higgins" Subject: Re: MDI Application Help Message-ID: X-Comment-To: comp.lang.java.gui Newsgroups: comp.lang.java.gui In-Reply-To: <1174023150.166496.158950@e65g2000hsc.googlegroups.com> References: <1174023150.166496.158950@e65g2000hsc.googlegroups.com> Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] Lines: 53 Date: Wed, 27 Apr 2011 15:32:03 GMT NNTP-Posting-Host: 96.60.20.240 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1303918323 96.60.20.240 (Wed, 27 Apr 2011 10:32:03 CDT) NNTP-Posting-Date: Wed, 27 Apr 2011 10:32:03 CDT Organization: TDS.net Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.gui:1220 To: comp.lang.java.gui "Noobie & Newbie" wrote in message news:1174023150.166496.158950@e65g2000hsc.googlegroups.com... > Hi guys, I am building a MDI application. In my MainClass(Parent), > there is a toolbar which contain many Jbutton. When I click > New(JButton in Toolbar), it will show a new JInternalFrame(Child) into > the JDesktopPanel. When i click Add(another JButton in ToolBar), it > will insert a pic into the JInternalFrame. The problem lies with that > when I call two JInternalFrame out (Frame_A & Frame_B), I am only able > to Insert pic in Frame_B since it is call out later. I know the > problem lies within this code of lines > > > public App app; > > private void newApp( java.awt.event.ActionEvent evt) // button new > event > { > app = new App(); > app.setVisible(true); > jDesktopPane1.add(app); > } > > It overwrite Frame_A when Frame_B is created > How can I solve this problem. > > Thanks. > I may be way off base here but... maybe use JInternalFrame.setSelected(true) at some point. from InternalFrameDemo.java http://java.sun.com/docs/books/tutorial/uiswing/components/examples/index.html#InternalFrameDemo //Create a new internal frame. protected void createFrame() { MyInternalFrame frame = new MyInternalFrame(); frame.setVisible(true); //necessary as of 1.3 desktop.add(frame); try { frame.setSelected(true); } catch (java.beans.PropertyVetoException e) {} } I'm sure you've seen the 'How to Use Internal Frames' tutorial. http://java.sun.com/docs/books/tutorial/uiswing/components/internalframe.html --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24