• Post Reply Bookmark Topic Watch Topic
  • New Topic

add ButtonGroup to a section of a panel

 
Nikos Stavros
Ranch Hand
Posts: 243
Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to add a ButtonGroup into a panel with a grid layout.

I get the following error

The method add(Component) in the type Container is not applicable for the arguments
(ButtonGroup)

thanks for any help
 
John Wetherbie
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried placing the ButtonGroup on its own panel and adding that to the container?
 
Nikos Stavros
Ranch Hand
Posts: 243
Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
unfortunately it didn't work

//sets up the radio button group;
group = new ButtonGroup();
//had problems adding radio group to main GUI, this line to try and fix
groupPanel = new Panel();
groupPanel.add(group);

I still got this error

The method add(Component) in the type Container is not applicable for the arguments
(ButtonGroup)
 
John Wetherbie
Rancher
Posts: 1449
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops, sorry! Didn't pay attention to what I wrote. You add the buttons to a button group so that when one is on the others are off. You add the individual buttons to the panel/container. You don't add the button group since it is just a logical grouping of buttons.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!