aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Moving JInternalFrame within JDesktopPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Moving JInternalFrame within JDesktopPane" Watch "Moving JInternalFrame within JDesktopPane" New topic
Author

Moving JInternalFrame within JDesktopPane

Sugantha Jeevankumar
Ranch Hand

Joined: Jun 06, 2007
Posts: 93
I have a JDesktopPane with multiple JInternalFrames opened. Now, whenever I hit a key combination like 'Ctrl+H' I would like a particular JInternalFrame (main window) to be brought to the front. This seems to work fine, with the main window brought to the front.

((JInternalFrame)<main window reference>).moveToFront();

But, once the window is on top of the other windows, I am not able to bring the other windows to the front by clicking on them. It seems like the main window is permanently set to have the lowest z-order.

I tried using JInternalFrame's show() method, whose API description seemed perfect for me,

public void show()
Shows this internal frame, and brings it to the front.

If this window is not yet visible, show makes it visible. If this window is already visible, then this method brings it to the front.


but it does not even bring the main window to the front. Any pointers are welcome. Thanks in advance.


SCJP 5.0
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4664
    
    5

To get better help sooner, post a SSCCE that demonstrates the problem.


luck, db
There are no new questions, but there may be new answers.
Sugantha Jeevankumar
Ranch Hand

Joined: Jun 06, 2007
Posts: 93
Hi.. I got it working by this minor code change,



Selecting the desired window and then moving it to front seems to do the trick...

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19785
    
  20

Thanks for sharing your solution


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Moving JInternalFrame within JDesktopPane