• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JButton is not displaying the background color

 
Dalia Sultana
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All, I have a JButton that pops up the color chooser on click and changes its background color when a new color is selected. This works fine unless I change the LookAndFeel of the dialog containing the button as follows.

UIManager.setLookAndFeel(new WindowsLookAndFeel());

When the LookAndFeel is set, it appears like the button is on a panel, and the panel is changing its background color. I understand that on WindowsLookAndFeel a gradient is drawn on top of the button to display that 3D look which is why the background color is not being shown. Just wondering if there is a work around for this.
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look on this page down toward the bottom under the heading "Potential Incompatibilities" at (the first) paragraph number 4607364.
 
Dalia Sultana
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great! That helped thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic