src/macosx/classes/com/apple/laf/AquaComboBoxUI.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -200,11 +200,13 @@
popup.getList().clearSelection();
}
}
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
class AquaCustomComboTextField extends JTextField {
+ @SuppressWarnings("serial") // anonymous class
public AquaCustomComboTextField() {
final InputMap inputMap = getInputMap();
inputMap.put(KeyStroke.getKeyStroke("DOWN"), highlightNextAction);
inputMap.put(KeyStroke.getKeyStroke("KP_DOWN"), highlightNextAction);
inputMap.put(KeyStroke.getKeyStroke("UP"), highlightPreviousAction);
@@ -284,10 +286,11 @@
actionMap.put("aquaHidePopup", hideAction);
SwingUtilities.replaceUIActionMap(comboBox, actionMap);
}
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
private abstract class ComboBoxAction extends AbstractAction {
public void actionPerformed(final ActionEvent e) {
if (!comboBox.isEnabled() || !comboBox.isShowing()) {
return;
}
@@ -304,10 +307,11 @@
}
/**
* Hilight _but do not select_ the next item in the list.
*/
+ @SuppressWarnings("serial") // anonymous class
private Action highlightNextAction = new ComboBoxAction() {
@Override
public void performComboBoxAction(AquaComboBoxUI ui) {
final int si = listBox.getSelectedIndex();
@@ -320,10 +324,11 @@
};
/**
* Hilight _but do not select_ the previous item in the list.
*/
+ @SuppressWarnings("serial") // anonymous class
private Action highlightPreviousAction = new ComboBoxAction() {
@Override
void performComboBoxAction(final AquaComboBoxUI ui) {
final int si = listBox.getSelectedIndex();
if (si > 0) {
@@ -332,27 +337,30 @@
}
comboBox.repaint();
}
};
+ @SuppressWarnings("serial") // anonymous class
private Action highlightFirstAction = new ComboBoxAction() {
@Override
void performComboBoxAction(final AquaComboBoxUI ui) {
listBox.setSelectedIndex(0);
listBox.ensureIndexIsVisible(0);
}
};
+ @SuppressWarnings("serial") // anonymous class
private Action highlightLastAction = new ComboBoxAction() {
@Override
void performComboBoxAction(final AquaComboBoxUI ui) {
final int size = listBox.getModel().getSize();
listBox.setSelectedIndex(size - 1);
listBox.ensureIndexIsVisible(size - 1);
}
};
+ @SuppressWarnings("serial") // anonymous class
private Action highlightPageUpAction = new ComboBoxAction() {
@Override
void performComboBoxAction(final AquaComboBoxUI ui) {
final int current = listBox.getSelectedIndex();
final int first = listBox.getFirstVisibleIndex();
@@ -369,10 +377,11 @@
listBox.ensureIndexIsVisible(target);
listBox.setSelectedIndex(target);
}
};
+ @SuppressWarnings("serial") // anonymous class
private Action highlightPageDownAction = new ComboBoxAction() {
@Override
void performComboBoxAction(final AquaComboBoxUI ui) {
final int current = listBox.getSelectedIndex();
final int last = listBox.getLastVisibleIndex();
@@ -484,16 +493,18 @@
action.actionPerformed(new ActionEvent(root, e.getID(), e.getActionCommand(), e.getWhen(), e.getModifiers()));
}
// This is somewhat messy. The difference here from BasicComboBoxUI.EnterAction is that
// arrow up or down does not automatically select the
+ @SuppressWarnings("serial") // anonymous class
private static final Action triggerSelectionAction = new AbstractAction() {
public void actionPerformed(final ActionEvent e) {
triggerSelectionEvent((JComboBox)e.getSource(), e);
}
};
+ @SuppressWarnings("serial") // anonymous class
private static final Action toggleSelectionAction = new AbstractAction() {
public void actionPerformed(final ActionEvent e) {
final JComboBox comboBox = (JComboBox)e.getSource();
if (!comboBox.isEnabled()) return;
if (comboBox.isEditable()) return;
@@ -508,10 +519,11 @@
comboBox.setPopupVisible(true);
}
};
+ @SuppressWarnings("serial") // anonymous class
private static Action hideAction = new AbstractAction() {
@Override
public void actionPerformed(final ActionEvent e) {
final JComboBox comboBox = (JComboBox)e.getSource();