src/macosx/classes/com/apple/laf/AquaComboBoxUI.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2011, 2013, 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
--- 1,7 ----
/*
! * 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,210 ****
--- 200,212 ----
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,293 ****
--- 286,296 ----
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,313 ****
--- 307,317 ----
}
/**
* 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,329 ****
--- 324,334 ----
};
/**
* 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,358 ****
--- 337,366 ----
}
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,378 ****
--- 377,387 ----
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,499 ****
--- 493,510 ----
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,517 ****
--- 519,529 ----
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();