Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Panel appears only when resizing JFrame.

 
Ranch Hand
Posts: 1139
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello i have a layout in which i have four buttons in the west side of my border layout, and when i click on any of button my panel of center layout gets change..
(ie, if i click home, the center of border layout get home panel, when i click register the center of border layout get register panel and so on....)
but the problem is the are appearing only when i m resizing my frame, i mean maximizing my frame..
here is my code:




CustomerLayout.java


Home.java

 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any time you change components when the parent is visible, you need to add the indicated lines

[container].add(someComponent);
[container].revalidate();//for swing//<----------------or next line (for awt), not both
[container].validate();//for awt
[container].repaint();//not always rerquired, safer to include//<------------------

from your description, the panel that changes would be more ideally suited to a CardLayout,
which would make revalidate()/repaint() unnecessary
 
Punit Jain
Ranch Hand
Posts: 1139
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it's working...thank you....
 
Get off me! Here, read this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic