Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

getting rid of window buttons

Hi
I need to find out how to get rid of or diable the little minimize, maximize and close buttons that are in the top right hand corner of the window. Do anyone know how?
:WAVE:
[198 byte] By [airrazor] at [2007-11-11 7:13:19]
# 1 Re: getting rid of window buttons
I have only seen that done for JInternalFrame, but then again, I haven't seen all. And,
just for the record, I have never seen Window applications that deny me the right to
do those things.
sjalle at 2007-11-11 22:39:04 >
# 2 Re: getting rid of window buttons
JWindow does that, but it is not recommended...there are a few tweaks you can do with a JFrame that removes the title bar, setDecorated*something method i think...if that doesn't work, try the sun java forum, i remember seeing that same question answered a while ago.
chimps at 2007-11-11 22:40:04 >
# 3 Re: getting rid of window buttons
...I have never used it until today. However, I failed to find any "warnings"
on its use, this is what the sun doc says:

A JWindow is a container that can be displayed anywhere on the user's desktop. It does not have the title bar, window-management buttons, or other trimmings associated with a JFrame, but it is still a "first-class citizen" of the user's desktop, and can exist anywhere on it.

To switch from a JFrame to a JWindow is easy though:

public static void main(String[] args) {
MyJFrame f=new MyJFrame("No Frame");
JWindow w=new JWindow();
//f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//f.setBounds(20,20,400,200);
//f.setVisible(true);
w.setContentPane(f.getContentPane());
w.setBounds(20,20,400,200);
w.setVisible(true);
}

Hmm.., better add a close/exit button somewhere... :p
sjalle at 2007-11-11 22:41:03 >