Skip to content

Commit

Permalink
BAM Converter: Improve usability for entering frame center values
Browse files Browse the repository at this point in the history
Pressing Enter accepts the current value of the center X and Y input fields
and moves the focus to the next logical UI control.
  • Loading branch information
Argent77 committed Nov 7, 2024
1 parent e2ec2d8 commit 971be9e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/org/infinity/gui/converter/ConvertToBam.java
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,18 @@ public void keyPressed(KeyEvent e) {
// List is set to single selection mode
doWithSelectedListItems(listFilters, list -> filterRemove(), true, "Remove selected filter?", null);
}
} else if (e.getSource() == tfFrameCenterX) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
// Accept current input value
framesValidateCenterValue(tfFrameCenterX);
tfFrameCenterY.requestFocusInWindow();
}
} else if (e.getSource() == tfFrameCenterY) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
// Accept current input value
framesValidateCenterValue(tfFrameCenterY);
cbCompressFrame.requestFocusInWindow();
}
}
}

Expand Down Expand Up @@ -1226,9 +1238,11 @@ private JPanel createFramesTab() {
tfFrameCenterX = new JTextField("0", 6);
tfFrameCenterX.setToolTipText(tip);
tfFrameCenterX.addFocusListener(this);
tfFrameCenterX.addKeyListener(this);
tfFrameCenterY = new JTextField("0", 6);
tfFrameCenterY.setToolTipText(tip);
tfFrameCenterY.addFocusListener(this);
tfFrameCenterY.addKeyListener(this);
cbCompressFrame = new JCheckBox("Compress frame");
cbCompressFrame.setToolTipText("Selecting this option activates RLE compression for the current frame(s).");
cbCompressFrame.addActionListener(this);
Expand Down

0 comments on commit 971be9e

Please sign in to comment.