Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Frame.class?

Status
Not open for further replies.

brownie124

Programmer
Sep 19, 2002
61
US
I was looking through the frame.java source code and noticed Frame.class is being passed as a parameter to some method calls within addToFrameList(). What is this exactly?

Does anyone know where exactly the code is that does the actual building and painting of a window? For example: I am specifically trying to find out where the - (Iconify) and x (close) boxes are created.

I am using JDK 1.2.

Thanks,
- Brownie
 
I could be mistaken, but AWT (Swing runs off the back of AWT) interfaces with the native OS to create windows/frames etc - so the I expect operations like iconify are utilised by native functions - on Linux probably X11, and on Windows the native Win32 API (probably through JNDI lookups/calls to the SO and DLLs that ship with the JDK). Whatever, frigging with the sun code is a bad idea persay because your programs become unshippable to other JDK versions or clients. Plus, all that you need should be catered for by AWT and Swing - you just need to find it !
 
Oh, I wasn't going to modify the Sun code. I just want to see how they do things. Specifically, I was trying to find in 1.4 where they prevent the iconify box from displaying in a window. Then, through my own code try to emulate that in 1.2.

All I want to do is capture and prevent the window from getting iconified. I think it is absolutely amazing that it is so difficult to do this. In Windows and on the Mac, this is so easy to do!

Thanks.
 
It is possible to disable the close button of the frame with :
Code:
this.disableEvents(AWTEvent.WINDOW_EVENT_MASK );
or by overriding
Code:
public void processWindowEvent(WindowEvent e)
But the Minimize and Maximize buttons don't care whether window_events are disabled. processWindowEvent() doesn't get called anymore, but the frame is still minimized or maximized.
 
Hologram,

Yes, I had tried both techniques and noticed that very thing: the close button doesn't function anymore but the iconify button continues to work. That makes no sense to me. Why can we not control that?

- Brownie
 
Brownie,

Another crazy idea : When you use a JWindow, you get rid of the window decoration, but you also loose a lot of other functionality.
But I think you can solve that by
- creating a JFrame,
- do everything you want with it,
- create a JWindow
- get the JRootPane from the JFrame
- set the JRootPane for the JWindow to the JRootPane of the JFrame
(You could switch the sequence)

Holo
 
setResizable(false) will also disable the maximize button, but NOT the minimize button (at least in JDK1.3.1 and JDK1.4.2)
 
Not really a reply but a request for some related assistance.

I have an application that uses a JFrame as the main GUI component. The user must *not* have the ability to exit the application so I have setup to DO_NOTHING_ON_CLOSE, which is fine except that users complain "the close button doesn't work". I would like to be able to "gray out" the exit (X) component but do not know how to get a reference to it. If I could I asume that a setEnabled(false) method would "gray it out". Any help would be greatly appreciated.

 
I'm not great at Swing, and if no-one comes up with the goods, you could do --- when the user clicks on close, pop up a message box saying ("You are not allowed to exit the programme") !!
 
JachMH,

For 1.4 you can do setUndecorated(true) and the X button will not be there.

- Brownie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top