Extras: use default activation keys if passing null to FlatInspector.install() or to FlatUIDefaultsInspector.install()

This commit is contained in:
Karl Tauber
2024-12-09 23:55:02 +01:00
parent 145631fd43
commit a400799db5
2 changed files with 8 additions and 2 deletions

View File

@@ -125,9 +125,12 @@ public class FlatInspector
* Installs a key listener into the application that allows enabling and disabling * Installs a key listener into the application that allows enabling and disabling
* the UI inspector with the given keystroke (e.g. "ctrl shift alt X"). * the UI inspector with the given keystroke (e.g. "ctrl shift alt X").
* *
* @param activationKeys a keystroke (e.g. "ctrl shift alt X") * @param activationKeys a keystroke (e.g. "ctrl shift alt X"), or {@code null} to use "ctrl shift alt X"
*/ */
public static void install( String activationKeys ) { public static void install( String activationKeys ) {
if( activationKeys == null )
activationKeys = "ctrl shift alt X";
KeyStroke keyStroke = KeyStroke.getKeyStroke( activationKeys ); KeyStroke keyStroke = KeyStroke.getKeyStroke( activationKeys );
Toolkit.getDefaultToolkit().addAWTEventListener( e -> { Toolkit.getDefaultToolkit().addAWTEventListener( e -> {
if( e.getID() == KeyEvent.KEY_RELEASED && if( e.getID() == KeyEvent.KEY_RELEASED &&

View File

@@ -85,9 +85,12 @@ public class FlatUIDefaultsInspector
* Installs a key listener into the application that allows enabling and disabling * Installs a key listener into the application that allows enabling and disabling
* the UI inspector with the given keystroke (e.g. "ctrl shift alt Y"). * the UI inspector with the given keystroke (e.g. "ctrl shift alt Y").
* *
* @param activationKeys a keystroke (e.g. "ctrl shift alt Y") * @param activationKeys a keystroke (e.g. "ctrl shift alt Y"), or {@code null} to use "ctrl shift alt Y"
*/ */
public static void install( String activationKeys ) { public static void install( String activationKeys ) {
if( activationKeys == null )
activationKeys = "ctrl shift alt Y";
KeyStroke keyStroke = KeyStroke.getKeyStroke( activationKeys ); KeyStroke keyStroke = KeyStroke.getKeyStroke( activationKeys );
Toolkit.getDefaultToolkit().addAWTEventListener( e -> { Toolkit.getDefaultToolkit().addAWTEventListener( e -> {
if( e.getID() == KeyEvent.KEY_RELEASED && if( e.getID() == KeyEvent.KEY_RELEASED &&