Help with layering graphics and components on JLayeredPane
I have a JLayeredPane in which in need to add different components to it and have them be layered one on top of the other, therefore I am adding a components to the JLayeredPane using the method add(Component comp, int index) and choose an appropriate index to specify the layer.
My challenge begins in that I am also overriding the paint(Graphics g) method and using the graphics object to draw a filled rectangle on the JLayeredPane which is updated/repainted once a second. The other components (JPanels) are only updated upon resize of the JLayeredPane and are specified on layers 1-3.
The problem that i am facing is that the filled rectangle is painted on top of the other components that i have added to the JLayeredPane where i would like it added behind.
Is there a way that i can specify an index for a layer to use for the graphics object so that it stays behind the other components that are added? Or do i need to re-design and try to use a JPanel instead of the Graphics object? Thanks in advance for any help. -
Message was edited by:
b12s

