Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stopping the use of Tab/Alt-F4 in a full-screen program in Java/Swing

I need a way to stop people using other programs while my Java program is running. i.e stopping people switch tabs and pressing Alt-F4.

like image 363
James Andrew Avatar asked Nov 29 '22 05:11

James Andrew


2 Answers

To make the program full screen use;

 window.setExtendedState(Frame.MAXIMIZED_BOTH); //maximise window

 window.setUndecorated(true); //remove decorations e.g. x in top right

And to make the window always on top use(To stop people using other running programs);

window.setAlwaysOnTop(true);
like image 51
Harry Martland Avatar answered Dec 11 '22 00:12

Harry Martland


You're not going to be able to do this at the Java level - you'll need to put the operating system into a "Kiosk Mode" of some kind.

Unsolicited commentary - Do you need this because you (or your customer) hate your users, and want them to curse you forever? Are you planning to add features like "shut down the computer" to your program?

like image 40
Curtis Avatar answered Dec 11 '22 00:12

Curtis