This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Change size of CardLayout  RSS feed

 
ruch sen
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I am unable to align the gridpanels in Swing because of fixed size of CardLayout.
I have a gridPanel gpTenderTypes for which i have used the Card Layout.



When a button is clicked, the card will change and the class will be called (for example, when creditcard button is clicked, creditcard card in the grid panel will be shown and the Card1() object will be called.



gpTenderTypes is added in another gridPanel gp2row along with 2 other gridpanels.



gp2row is added in the screen:



I've realized that the size of the CardLayout remains constant irrespective of changing its size using setSize or setPreferredSize. Changing the dimensions of the other GridPanels (gpCustDet, gpButtonsPanel) is of no use either.


How do i do fix this?
Thank you!
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1103
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

You have provided few bits of 'your' code which we can't understand anything about.
So, create a small program which demonstrates the problem and which can be copied, compiled and executed by us - remember to remove all irrelevant stuff and post only the relevant working code.
It is called SSCCE
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When adding components to or removing them from an already visible GUI, it's necessary to call revalidate() and repaint() when done.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!