In my Swing application, I want the ability to switch between decorated and undecorated without recreating the entire frame. However, the API doesn\'t let me call setU
Here is a code in how to make ALT + Enter enters Full Screen without the bar mode and Minimize with showing the Title bar and the Start bar:
public class myTest extends JFrame{
//Your codes...
//if "ALT" key on hold and "Enter" key pressed with it
if (evt.isAltDown() && evt.getKeyCode() == evt.VK_ENTER) {
//if the JFrame has Title bar
if (isUndecorated()) {
//this will dispose your JFrame
dispose();
//here to set it with no Title bar
setUndecorated(false);
pack();
setLocationRelativeTo(null);
//as you dispose your JFrame, you have to remake it Visible..
setVisible(true);
} else {
dispose();
setUndecorated(true);
setExtendedState(MAXIMIZED_BOTH);
setVisible(true);
}
}
//your codes
}