• Post Reply Bookmark Topic Watch Topic
  • New Topic

JInternalFrames  RSS feed

 
vijay kumar sharma
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

i am facing a problem in using JInternalFrames.

I created a JFrame and i added some JButtons ,viewport, graphics and JPanel to the jframe.
At present i want to add a JInternalFrame to it.

when i am adding the jinternalframe it is removing all the elements in jframe.

please help me.

Thanks in advance.
 
Rob Spoor
Sheriff
Posts: 20898
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"vijji wants",

Will you please check your private messages regarding an important message?

Thank you,

Rob


As for your problem, a JFrame (actually its content pane) uses a BorderLayout. This allows you to have only one component in the center. At the moment that is your JPanel. If you add a component without any constraints it will overwrite the current center component. You should either use some constraints (like BorderLayout.NORTH; check the BorderLayout API) or set a different LayoutManager using the setLayout method.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!