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

Always in Front

Dave Donohoe
Ranch Hand

Joined: May 16, 2000
Posts: 73
I have a JInternalFrame & I want to be able to keep this window to the front (same as the always on top feature of WinZip 8.0)
I dont want to make it a modal dialog because I still want the user to be able to interact with the other items on the screen while the JInternalFrame is displayed.....any ideas?
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

OK, a few questions... you are using a JInternalFrame... do do you want it to be always on top in it's JDesktopPane, or do you want it to be always on top of the system desktop?

It's probably possible to make it always on top in the JDesktopPane ( by always sending it to the highest layer of the JDesktopPane... JDesktopPane extends JLayeredPane... ), but it's not possible to make a system modal frame or dialog in Java without using calling platform-dependent native code.

-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Dave Donohoe
Ranch Hand

Joined: May 16, 2000
Posts: 73
Thanks for your reply, Nate.
Basically I want the JInternalFrame modal with regard to the Application not the System.
Using a different Layer of JLayeredPane worked perfectly!
D
Tanveer Rameez
Ranch Hand

Joined: Dec 11, 2000
Posts: 158
hi
I am creating an image proceesing application.
(check it out at http://tanveer.0catch.com/programming/JPhotoBrush.htm )
I have several JInternal Frames inside the main frame. All but one internal frames will contain images and one JInternalFrame will contain the histogram of the currently selected JInternalFrame containing the image. I want this histogram internal frame to be always on top.
This may sound confusing. Let me explain: I have internal frames a,b,c,d all containing images. on clicking on any of these internal frames, it becomes selected (This I have done). Now in addition to that, I want another internal frame say X to be always on top. So it looks as if there are two selected internal frames (one may be any one of a,b,c,d) and thge other X. But I think a single desktop cannot have two selected internal frames. How do I make it possible.
can anybody help me?
Regards
Tanveer
[ February 05, 2002: Message edited by: Tanveer Rameez ]

Author of JPhotoBrush Pro (www.jphotobrushpro.com)
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Tanveer,

JPhotoBrush looks awesome!

When you add the JInternalFrame that contains the histogram, add it like this :



This sends the internal frame to a higher layer of the desktop pane. This should be enough to make your histogram frame always on top in the desktop.

To make it look selected, you'll have to use a subclass of JInternalFrame that overrides isSelected() to always return true.

Here is a quick example that shows the techniques discussed :



-Nate
Tanveer Rameez
Ranch Hand

Joined: Dec 11, 2000
Posts: 158
thanks for the help.The histogram frame looks nice when it is always on top!!.
regards
Tanveer
Tanveer Rameez
Ranch Hand

Joined: Dec 11, 2000
Posts: 158
one thing..the URL I gave is now in one of my previous posts in this page is now invalid. So to know more about the java image processing software and download it visit: http://tanveer.freeservers.com and then go directly to the programming section. There click on 'Lastest cool stuff' link.
The site where I initially uploaded my zip file and self extractor was deleted becoz the site does not allow zip and exe files.
 
 
subject: Always in Front
 
Similar Threads
JFrame, Image/Graphics and JInternalFrame
Using JInternalFrame and JDesktop
MouseEvent handling.
Events from inner components.
Moving JInternalFrame within JDesktopPane