The Artima Developer Community
Sponsored Link

Java Answers Forum
JToggleButton Question

3 replies on 1 page. Most recent reply: Apr 20, 2004 3:02 AM by Matthias Neumair

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

JToggleButton Question Posted: Apr 19, 2004 11:29 PM
Reply to this message Reply
Advertisement
I know this seems a stupid question, but I really don't get it:

How can I set the background color of a selected JToggleButton?

With setBackground I can set the background if the button is not selected, but if selected, the button remains dark gray.

Nice aspect: If I set setOpaque (false), the button is only transparent, if it is not selected. If it is selected, it turns dark gray.


mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: JToggleButton Question Posted: Apr 20, 2004 2:02 AM
Reply to this message Reply
UIManager.put("ToggleButton.background", Color.RED);
UIManager.put("ToggleButton.select", Color.GREEN);	
		
JToggleButton button3 = new JToggleButton("Toggle Button");
//THIS WILL WORK

mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: JToggleButton Question Posted: Apr 20, 2004 2:03 AM
Reply to this message Reply
>>>>> I know this seems a stupid question, but I really don't get it:

The only stupid question is the question that is never asked.

It was not a stupid one.

Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: JToggleButton Question Posted: Apr 20, 2004 3:02 AM
Reply to this message Reply
thanks for the help.

Flat View: This topic has 3 replies on 1 page
Topic: help me plz "where is the rong in this code " Previous Topic   Next Topic Topic: converting

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use