CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Dec 2012

    JPanel as a background for another JPanel

    Hey Codegurus,

    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!

  2. #2
    Join Date
    May 2006

    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.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.