Win a copy of Hands On Software Engineering with Python this week in the Jython/Python 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

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
 
Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!