This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to add Gradient colors to JComponents.  RSS feed

 
Udara Amarasinghe
Ranch Hand
Posts: 109
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I want to add gradient color to JButton and JPanel. This is my code can you help me to solve this mater.

 
pete stein
Bartender
Posts: 1561
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what specifically is not working for you? Tell us this and we'll be much better able to help you. My guess is to add a gradient color background, paint it in the JComponent's paintComponent method. For instance:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!