Skip to content

Commit

Permalink
Add ctrl+comma for options dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
DC37 committed Oct 20, 2021
1 parent 4d435e5 commit e41f2f4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/smp/components/buttons/OptionsButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import javafx.scene.control.Slider;
import javafx.scene.control.TextField;
import javafx.scene.image.ImageView;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.VBox;
Expand Down Expand Up @@ -74,6 +76,19 @@ public class OptionsButton extends ImagePushButton {
*/
public OptionsButton(ImageView i, SMPFXController ct, ImageLoader im) {
super(i, ct, im);

ct.getBasePane().addEventHandler(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {

@Override
public void handle(KeyEvent event) {
if (controller.getNameTextField().focusedProperty().get())
return; // Disable while textfield is focused

if(event.isControlDown() && event.getCode() == KeyCode.COMMA)
reactPressed(null);
}
});

}

@Override
Expand Down

0 comments on commit e41f2f4

Please sign in to comment.