I would like to know if it is possible to create a JFrame
window which has no default maximize/minimize(-) and close(x) buttons! I have added custom buttons on each frame so that the user does not have to mess around with the default ones on the top right corner of the window!
Use the ResizeMode property By setting the ResizeMode property to CanMinimize only the Minimize button will be visible. The maximize button will be hidden and the resizing will be disabled. This is demonstrated in Example 2.
Here is the code to disable maximize and close button: JFrame frame = new JFrame(); frame. setResizable(false); //Disable the Resize Button // Disable the Close button frame.
You need to use setVisible(false) on the instance of the window you've created earlier.
You have to add the button and add an actionListener on the button. Then in the actionPerformed method of that action listener, call the . dispose() method on the frame you want to get rid of.
You can use JWindow because is by default un_decorated, but you can setUndecorated() for JFrame/JDialog
another ways are
implements WindowListener
setDefaultCloseOperations
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With