This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to set the color of a button and toolbar ?

 
Avin Sinanan
Ranch Hand
Posts: 109
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I was wondering if anyone out there knows how to set the colour of a JButton and a JToolBar to say.. red .
Usually the button and toolbars are grey. I want to change this to give the program a more professional look.
any ideas?
thanks
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JButton inherits setBackground(Color) from JComponent. So, this:

JButton jbutton = new JButton("JButton");

jbutton.setBackground(Color.red);

creates a new JButton and sets its color to red.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The same goes for JToolBar.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic