| | |
| | if( hwState == SWITCH_RELEASED ) { |
| | - timer.addActionListener( ( event ) -> { |
| | - updateSwitchState( switchState ); |
| | - updateSwitchLabel( switchState ); |
| | - } ); |
| | + timer.addActionListener( |
| | + ( event ) -> updateKeyboardLabel( switchState ) |
| | + ); |
| | } |
| | else { |
| | timer.stop(); |
| | - updateSwitchState( switchState ); |
| | - updateSwitchLabel( switchState ); |
| | + updateKeyboardLabel( switchState ); |
| | } |
| | } |
| | else { |
| | updateSwitchState( switchState ); |
| | } |
| | } |
| | |
| | protected void updateSwitchState( final HardwareSwitchState switchState ) { |
| | - final var component = getHardwareComponent( switchState ); |
| | - component.setState( switchState ); |
| | + getHardwareComponent( switchState ).setState( switchState ); |
| | } |
| | |
 |
| | * @param state The key that has changed. |
| | */ |
| | - protected synchronized void updateSwitchLabel( |
| | + protected synchronized void updateKeyboardLabel( |
| | final HardwareSwitchState state ) { |
| | + updateSwitchState( state ); |
| | final var hwState = state.getHardwareState(); |
| | |
 |
| | // Label for number pad keys or icon glyphs. |
| | main.setText( keyValue.substring( index + 1 ) ); |
| | - main.transform( .9f ); |
| | + main.transform( .8f ); |
| | |
| | // Shift the main label down away from the superscript. |
| | final var mainLoc = main.getLocation(); |
| | - main.setLocation( mainLoc.x, mainLoc.y + (sup.getHeight() / 3) ); |
| | + main.setLocation( mainLoc.x, mainLoc.y + (sup.getHeight() / 2) ); |
| | |
| | main.setVisible( true ); |