aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Setting a gradient on a Master JPanel made of sub JPanels Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Setting a gradient on a Master JPanel made of sub JPanels" Watch "Setting a gradient on a Master JPanel made of sub JPanels" New topic
Author

Setting a gradient on a Master JPanel made of sub JPanels

john kalaigian
Greenhorn

Joined: Nov 20, 2001
Posts: 15
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
 
jQuery in Action, 2nd edition
 
subject: Setting a gradient on a Master JPanel made of sub JPanels