JTabbedPane to select JInternalFrames in a DesktopPane
Hello,
I would like to know how I can manage JInternalFrames in a desktoppane by tabs in JTabbedPane i.e. I would like to have the following functionality:
1. DesktopPane with Diagrams (internal frames).
2. Selecting a tab in JTabbedPane should select a particular diagram.
This allows me to have the flexibility to see more than 1 diagram at a time, which is not possible if I use JTabbedPane alone.
Thanks in advance.
[456 byte] By [
vicky1981a] at [2007-11-27 6:09:24]

# 1
Probably not the best solution... JTabbedPane isn't really a good option for what you want.
I would create a simple row of buttons (probably toggle buttons), each tied to an iframe, and when clicking a button, bring the corresponding frame to the front. Likewise, if the frame is moved to the front otherwise, then the corresponding button should be selected.
# 2
Hi,
Thanks
I have something like that running. But I wonder whether I will have the same look and feel like the JTabbedPane.
I have some problem with the layouts. I have the desktoppane and the panel containing togglebuttons in a JPanel whose layout is Borderlayout. and the layout for panel containing buttons is flowlayout. I have problems to wrap the buttons to the next row when i open to many internalframes. same when I resize the frame.
Any suggestions?
# 3
You can change the buttons do have whatever look you want, but not, it wont' look exactly like tabs in a JTabbedPane without you doing something.
WrapLayout, found here, can help with your buttons.
http://www.discoverteenergy.com/files/WrapLayout.java
JDesktopPane doesn't really do much except provide a basic container for iframes. It doesn't control their layout. You'd have to write code to do something special like tiling the iframes.