Fix @Deprecated warnings related to AWT KeyStroke codes

This commit is contained in:
Reinhard Pointner 2017-10-16 21:17:37 +02:00
parent 9f2aaa6ca8
commit 861a218c9b
4 changed files with 8 additions and 8 deletions

View File

@ -96,7 +96,7 @@ public class MainFrame extends JFrame {
setMinimumSize(new Dimension(900, 340)); setMinimumSize(new Dimension(900, 340));
// KEYBOARD SHORTCUTS // KEYBOARD SHORTCUTS
installAction(getRootPane(), getKeyStroke(VK_DELETE, CTRL_MASK | SHIFT_MASK), newAction("Clear Cache", evt -> { installAction(getRootPane(), getKeyStroke(VK_DELETE, CTRL_DOWN_MASK | SHIFT_DOWN_MASK), newAction("Clear Cache", evt -> {
withWaitCursor(getRootPane(), () -> { withWaitCursor(getRootPane(), () -> {
CacheManager.getInstance().clearAll(); CacheManager.getInstance().clearAll();
log.info("Cache has been cleared"); log.info("Cache has been cleared");

View File

@ -56,8 +56,8 @@ public class SelectButtonTextField<T> extends JComponent {
editor.setUI(new TextFieldComboBoxUI(selectButton)); editor.setUI(new TextFieldComboBoxUI(selectButton));
editor.setMaximumRowCount(10); editor.setMaximumRowCount(10);
SwingUI.installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.CTRL_MASK), new SpinClientAction(-1)); SwingUI.installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.CTRL_DOWN_MASK), new SpinClientAction(-1));
SwingUI.installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.CTRL_MASK), new SpinClientAction(1)); SwingUI.installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.CTRL_DOWN_MASK), new SpinClientAction(1));
} }
public String getText() { public String getText() {

View File

@ -72,8 +72,8 @@ public class EpisodeListPanel extends AbstractSearchPanel<EpisodeListProvider, E
searchTextField.getSelectButton().addPropertyChangeListener(SelectButton.SELECTED_VALUE, selectButtonListener); searchTextField.getSelectButton().addPropertyChangeListener(SelectButton.SELECTED_VALUE, selectButtonListener);
installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.SHIFT_MASK), new SpinSeasonAction(1)); installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.SHIFT_DOWN_MASK), new SpinSeasonAction(1));
installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.SHIFT_MASK), new SpinSeasonAction(-1)); installAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.SHIFT_DOWN_MASK), new SpinSeasonAction(-1));
} }
@Override @Override

View File

@ -140,7 +140,7 @@ public final class SwingUI {
} }
public static boolean isShiftOrAltDown(InputEvent evt) { public static boolean isShiftOrAltDown(InputEvent evt) {
return checkModifiers(evt.getModifiers(), ActionEvent.SHIFT_MASK) || checkModifiers(evt.getModifiers(), ActionEvent.ALT_MASK); return checkModifiers(evt.getModifiersEx(), InputEvent.SHIFT_DOWN_MASK) || checkModifiers(evt.getModifiersEx(), InputEvent.ALT_DOWN_MASK);
} }
public static boolean isShiftOrAltDown(ActionEvent evt) { public static boolean isShiftOrAltDown(ActionEvent evt) {
@ -200,14 +200,14 @@ public final class SwingUI {
component.getDocument().addUndoableEditListener(undoSupport); component.getDocument().addUndoableEditListener(undoSupport);
// install undo action // install undo action
installAction(component, KeyStroke.getKeyStroke(KeyEvent.VK_Z, KeyEvent.CTRL_MASK), newAction("Undo", evt -> { installAction(component, KeyStroke.getKeyStroke(KeyEvent.VK_Z, KeyEvent.CTRL_DOWN_MASK), newAction("Undo", evt -> {
if (undoSupport.canUndo()) { if (undoSupport.canUndo()) {
undoSupport.undo(); undoSupport.undo();
} }
})); }));
// install redo action // install redo action
installAction(component, KeyStroke.getKeyStroke(KeyEvent.VK_Y, KeyEvent.CTRL_MASK), newAction("Redo", evt -> { installAction(component, KeyStroke.getKeyStroke(KeyEvent.VK_Y, KeyEvent.CTRL_DOWN_MASK), newAction("Redo", evt -> {
if (undoSupport.canRedo()) { if (undoSupport.canRedo()) {
undoSupport.redo(); undoSupport.redo();
} }