• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Color for Button in Windows look and feel

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a swing application. The look and feel for that application is WINDOWS LOOK AND FEEL. I have a JButton in it. When i try to set the color for JButton using

JButton button = new JButton("OK");
button.setBackground(Color.GREEN);

But i am not getting the color in Button. Same code works if i just change the look and feel to defalt java look and feel.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JButton button = new JButton("OK");
button.setBackground(Color.GREEN);
button.setContentAreaFilled(false);
button.setOpaque(true);
 
Karthick Dharani Vidhya
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks that worked.. But this button alone looks some what different when compared to all other buttons in this panel...

This button looks like java look and feel

and all other button looks like windows look and feel...
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4880747

scroll down to 'Evaluation'
 
Karthick Dharani Vidhya
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot!! I learnt it today!! I posted one more query for JButton in Windows Look and Feel.. The prob is when i add mnemonic to a button I am not getting '_' below that particulat letter in the Button name. Is there any way to get the '_' in Button Name using windows look and feel.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if xp, the default for mnemonics is 'hidden' (I think)

control panel/display/appearance/effects
and uncheck 'Hide underlined letters......'
 
Doody calls. I would really rather that it didn't. Comfort me wise and sterile tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic