December 7th, 2012, 08:37 AM
JPanel as a background for another JPanel
I want to draw some lines in a JPanel and then put another JPanel on top of it with another set of lines. I'd like to do this because i don't want to repaint the grid of lines every time im done making a graph.
Is there an easy way to go about doing this?
Thanks in advance!
December 7th, 2012, 10:41 AM
Re: JPanel as a background for another JPanel
You can either add both the JPanels to the container panel and set their Z order to have one display over the other or you can set the lower JPanel's layout manager to BorderLayout and add the upper JPanel to it's center position. In either case you will also have to set the upper panel to transparent using setOpaque(false) so the lower panel shows through it.
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!