How to put JFrame into existing JPanel in Java Swing?
Posted
by
suud
on Stack Overflow
See other posts from Stack Overflow
or by suud
Published on 2012-10-17T04:27:32Z
Indexed on
2012/10/17
5:01 UTC
Read the original article
Hit count: 252
I have an open-source java swing application like this: http://i47.tinypic.com/dff4f7.jpg
You can see in the screenshot, there is a JPanel divided into two area, left and right area. The left area has many text links. When I click the SLA Criteria link, it will pop-up the SLA Criteria window. The pop-up window is JFrame object.
Now, I'm trying to put the pop-up window into right area of the JPanel, so that means no pop-up window anymore, i.e. when I click the SLA Criteria link, its contents will be displayed at the right area of the JPanel. The existing content of the right area of JPanel will not be used anymore.
The example illustration (note: it's made and edited using image editor, this is not the real screenshot of working application) is like this:
http://i48.tinypic.com/5vrxaa.jpg
So, I would like to know is there a way to put JFrame into JPanel?
I'm thinking of using JInternalFrame, is it possible? Or is there another way?
UPDATE:
Source code:
http://pastebin.com/tiqRbWP8 (VTreePanel.java, this is the JPanel)
http://pastebin.com/330z3yuT (CPanel.java, this is the super class of VTreePanel)
http://pastebin.com/MkNsbtjh (AWindow.java, this is the JFrame, pop-up window)
http://pastebin.com/2rsppQeE (CFrame.java, this is the super class of AWindow)
© Stack Overflow or respective owner