Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting a gradient on a Master JPanel made of sub JPanels

 
john kalaigian
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to use a gradient as a eye pleasing background for a JPanel that I have (very much like the search entry panel used in Limewire). I have one main Class that extends JPanel with a paintComponent method in it which handles the gradient painting. The problem is that when i start adding what I call sub JPanels onto the extended JPanel (this) I don't see the gradient painted on those particular panels. Why is that - and another question is can i implicitly call paintComponent(Graphics g) without extending the JPanel class. I'm afraid I don't quite see how paintComponent(Graphics g) is implicitly called in the background, although I understand that it as well as paint are already part of any AWT Component. Thanks in advace, John
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic