• Post Reply Bookmark Topic Watch Topic
  • New Topic

Buttons on CardLayout  RSS feed

 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello all,
it is the first time I am using CardLayout and I am definitly doing something wrong.
my problem is that any CheckBoxes and RadioButtons on the cardlayout-panels don't act like they should. That is, when I click on them nothing happens. Only after changing the cards and coming back to the specific button again, it might be selected. Same with selections in TextAreas.
(I am using only swing components, even if I leave the capital J out.)
here is the code where I add the different panels (=cards) to the main panel with the cardlayout:

the createCardPanel() method looks like this:

I put the JCheckBox called test in the panel to see if at least this one could be used properly, but that is not the case.
I am sure there is some big bug in the way I am constructing the CardLayout. I would appreciate if someone could give me a hint!
Thanks a lot
Chantal
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, I found the bug myself and it is as stupid as I thought it would be: I did actually mix swing and awt as my hitsPanel is of type Panel not JPanel.
Well, there had to be a first time for this.
cheers
chantal
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!