This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

internal frame error  RSS feed

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to lunch an internal frame from an menu item,but when i lunch it from main frame,the main frame's content becomes invisble,can any one tell
me,how can i make main frame's content's visble even after internal frame has been lunched from main frame,here is the code i wrote

[import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class internalframe extends JFrame
{
JMenuBar bar;
JMenu m1,m2,m3,m4;


public internalframe()
{


super("internal frame demo");

bar=new JMenuBar();
m1=new JMenu("launch inernal frame");
JMenuItem ie=new JMenuItem("open frame");
Container c1=getContentPane();

//c1.add(bar);
bar.add(m1);
m1.add(ie);
setJMenuBar(bar);

//anonymos classes
ie.addActionListener(new ActionListener( ) {
public void actionPerformed(ActionEvent e)
{

JDesktopPane d1=new JDesktopPane();

JInternalFrame i1=new JInternalFrame("my experiments",true,true,true,true);
d1.add(i1);
//i1.add(b1);
setContentPane(d1);
i1.setVisible(true);
i1.setBounds(300,200,400,100);

i1.setLayout(new FlowLayout());

}
});


}
public static void main(String args[])
{
internalframe in=new internalframe();
in.setVisible(true);
in.setBounds(300,200,200,300);
in.setSize(100,300);
in.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
in.setLayout(new FlowLayout());


}

}] [/CODE]
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I noticed you are creating the JDesktopPane in the listener. I would think you would want to create it and add it to the JFrame's content pane when initializing the frame. Maybe that would help.
 
Puneet N Vyas
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can any body modify the code to display the main frame's components after the internalframe is lunched
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!