Quick beginner radio button question
I'm trying to set up a JFrame shopping cart example for my class. I've added radio buttons to a button group "colorButtonGroup" to denote one of three colors (blue, red, yellow), and I'm not sure as to how to add the button group to my main panel. What am I missing? How do I add the button group to my main panel?
mainPanel.add(colorButtonGroup);
I'm new to programming, and was hoping this would be an easy problem to resolve. I originally placed the individual radio buttons directly onto the main panel but was having trouble with the actionListener.
Re: Quick beginner radio button question
You don't add the ButtonGroup to the Container. You add each button. A ButtonGroup is not an actual Component, it's just a way to link the models of the buttons together.
Re: Quick beginner radio button question
Works for me (not literally), thanks