I would like to apply my own close and minimize buttons. Is there any way to change the JFrame
design?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
The trick lies in the PLAF and
setDefaultLookAndFeelDecorated(true)
(Specifying Window Decorations).E.G.
jframe undecorated
.jlabel
for each button.Btn
.mouseListeners
for eachjlabel
and specify code eg,System.exit(0);/set ICONIFIED option
The only thing I'm aware that can be done is to add a
WindowListener
to theJFrame
and handle closing events in that listener. You can make virtually anything, like displaying dialogs or even cancelling the closing of theJFrame
.See this tutorial for more details about how to write such listeners.
As for minimizing: as far as I know, there is no way to control or modify such behaviour, it's completely controlled by the operating system.
The only way to change the aspect of the minimize/close/maximize buttons is to use a custom LookAndFeel and setting
JFrame.setDefaultLookAndFeelDecorated (true);
.think you are after a JWindow
http://docs.oracle.com/javase/7/docs/api/javax/swing/JWindow.html
You can then create your own buttons which actions can minimize/close your window