I have 4 radio buttons in a group box. When the user selects any one, the background color should change to whatever color is associated with the radio button. I have it coded but here is my problem. When the radio button is checked the color checked flashes and then goes away. The same thing happens when any of the 4 buttons is checked. Any Suggestions? Thanks,
I think we're definitely going to need a few specifics on this. Some code would be good. If not, atleast let us know if you're using Swing or AWT and what event are you handling to change the BGColor as also how you're changing it. See ya soon
Here are some pieces of the code. The entire program would be too large to paste in this forum. I hope everything is here that would be needed to see if there is a problem. These buttons get created and added to a box layout. That box layout gets add to west section of a border layout.
Welcome to the Ranch Craig. set the background to the content pane of the JFrame by getContentPane().setBackground(color); The blue button was not given listener. The gray button was not added to the ButtonGroup
I added those changes and know the background doesn't even flash the color. I am kind of new to all this and a bit confused. I have added my entire code hoping for a little help. The code is still a work in progress and nees a lot work to dress it up. I have also commented out several lines of code for my testing. The only area I am concerned about is how the radio buttons can change the background color of my application. If anyone can help it would be appreciated.
The container is behind the JPanels you placed on the different regions of the BorderLayout. Thus if you set its color you will not see any change. Set the color of westPanel, eastPanel etc. You might also have a look at How to write an ItemListener in the Java Tutorial.