- painting to Top-Level Containers (inherits, nested on AWT methods) is accesible only from AWTs paint()
- put there JPanel (in the case that will be container for JComponents) or plain JComponent
- by default there isn't any problem to painting transparent or translucent image in Swing
- note thre are a few awfull changes for translucency in Java7, important is code ordering, changing L&F for decorated Top-Level Containers isn't possible without dirty hacks
I don't know why I have new'ed the color1 property, but I
still get null pointer exception.
Does anyone spot any errors?
I also wonder do I override paintComponent(Graphics g) instead, but I don't think there is one to override.
- you are ignoring (btw as always) all mentioned points in previous posts
- your code is GPU killer, don't to set whatever different as paitning in paint, paintComponent, paintChildren
- again put there JPanel override paintComponent
EDIT
- never extends anything, nor Top-Level Containers
- code ordering should be (as aside note in Java7 isn't possible to create undecorated container) important, runnable in Java7,I'm leaving important workaroung for Java7
Hi,
The gradient paint works now.
But One problem I am facing is when I override the paint method of JDialog
and adding JPanels and JLayeredPane's to this JDialog
The original contents of the JPanels and JLayeredPane's are overwritten,
How can I make the Gradient stay in the background?
Thanks
Jack