i want to create a vertical JDesktopPane thus when a JInternalFrame minimizes its icon adds at the left side of Jframe and vertically below other icons not next to the previous icons and horizontally. it may be the same as linux or mac desktopPane that their desktopPane is at the left side of screen not at the bottom.
-
1I think you'll need a custom `DesktopPaneUI`. – Catalina Island Oct 06 '15 at 09:00
-
would you tell me how i can create one because i can not find it anywhere? thank you – arash Oct 06 '15 at 09:52
-
1The supported L&Fs are [here](http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/). – trashgod Oct 06 '15 at 10:43
-
thanks you for your help – arash Oct 06 '15 at 13:01
1 Answers
You should probably create a custom DesktopManager
. The DesktopManager is responsible for managing the desktop. In particular you would want to extend the DefaultDesktopManager as it provides the current support for positioning the buttons of the minimized internal frames.
In particular I would think you need to override the getBoundsForIconOf(...)
method and probably the getPreviousBounds(...)
. You could look at the source code to see how it works for the horizontal layout and modify the code for your vertical layout.
This posting has a little example to get you started: //stackoverflow.com/questions/18433475/jdesktoppane-minimising-jinternalframes. Normally when you maximize an internal frame it will cover any iconified buttons. The custom code will only maximize the internal frame to the top of the iconified buttons.

- 321,443
- 19
- 166
- 288
-
thank you for your response i think this is the right way...but whenever i override DesktopManager functions it throw null pointer exception Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.RepaintManager.getVolatileOffscreenBuffer(RepaintManager.java:1030) at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1489) com.apple.laf.AquaInternalFrameDockIconUI$ScaledImageLabel.updateI on(AquaInternalFrameDockIconUI.java:193) at com.apple.laf.AquaInternalFrameDockIconUI$ScaledImageLabel.paint(AquaInternalFrameDockIconUI.java:204) – arash Oct 07 '15 at 11:10
-
i mean as i set DesktopManager() i receive a null pointer exception when i minimize internalJframe just like this issue http://stackoverflow.com/questions/28774432/exception-in-the-iconization-of-jinternalframe-with-defaultdesktopmanager – arash Oct 07 '15 at 12:29
-
I gave you a link containing working code. Did you copy and try the code? Does it have an Exception? – camickr Oct 07 '15 at 15:08
-
yes i copy that code. but as i said whenever i set DesktopManager a null pointer exception has been thrown. – arash Oct 07 '15 at 15:10
-
Well I don't use Apple so I don't know what the problem is. Maybe you need to extend the Apple DesktopManager, (instead of the DefaultDesktopManager) whatever the class is that Apple uses. – camickr Oct 07 '15 at 15:16
-
You don't need to search just add `System.out.println(desktopPane.getDesktopManager());` to your code to see what class is being used as the desktop manager. – camickr Oct 07 '15 at 15:45