Skip to main content

How to close a JFrame without a mouse

5 replies [Last post]
brinkley
Offline
Joined: 2003-06-06

How should a JFrame be closed without a mouse?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
zander
Offline
Joined: 2003-06-13

The window manager typically uses Alt-F4, but do note that that means the WM will kill the JFrame, which typically means a method is called that registeres such a change.

Most styleguides I know of also ask the application to implement ctrl-q (apple-q) which does a destroy, and other cleanup.

Note that a JFrame does not imply any context so you don't know if it is a document, help window or even a status window so ctrl-w (for closing the document) or even obscure keycombinations like tabbing to a 'close' button are possible.

charles.armstrong
Offline
Joined: 2006-02-17

A low tech solution is to have a 'Done' button with a mnemonic on it.

srotman
Offline
Joined: 2003-06-16

By calling the hide() or the dispose() method.

brinkley
Offline
Joined: 2003-06-06

User not developer.

mgrev
Offline
Joined: 2003-08-12

Try Alt + F4