Re: Layer JPanels ?
- From: Ian Shef <invalid@xxxxxxxxxxxxx>
- Date: Tue, 27 Feb 2007 19:11:10 GMT
"Tony B" <tagb61@xxxxxxxxxxx> wrote in
news:5SZEh.44632$gM1.39982@xxxxxxxxxxxxxxxxxxxxxx:
I'm new to Java and trying to create a simple GUI for the first time.I don't understand this. The default LayoutManager is BorderLayout, and
Is it possible to layer JPanels and setVisible one at a time ?
I'm creating 3 JPanels, and I want to show 1 of the 3 on the main JFrame
Content Pane under menu control.
At the moment if I do this the last one added is always displayed. So I
guess the last contentPane.add(JPanel3) effectively removes the other 2
which makes sense.
the default is to add to the center region, so I would expect that you
would always see the first one added. contentPane.add(JPanel3) should add
to the end of the list, at the bottom of the stacking order (see the
description of class java.awt.Container). The content pane is supposed to
be a Container, although I suppose it could be something that inherits
from Container but implements stacking order differently.
Can you please supply a SSCCE ?
Yes.
I tried putting all 3 JPanels in a single JPanel, and adding this to the
content pane. Then I have the problem they are added in different parts
of the content pane.
Is there a layout manager that forces JPanels to displayCardLayout
on top of each other ?
No.
Maybe I'm taking the wrong approach. Can I programatically
contentPane.add(JPanel1or2o3) instead ?
Tony
--
Ian Shef 805/F6 * These are my personal opinions
Raytheon Company * and not those of my employer.
PO Box 11337 *
Tucson, AZ 85734-1337 *
.
- References:
- Layer JPanels ?
- From: Tony B
- Layer JPanels ?
- Prev by Date: Re: Layer JPanels ?
- Next by Date: Re: Handling exceptions in SwingWorker
- Previous by thread: Re: Layer JPanels ?
- Index(es):
Relevant Pages
|
|