21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package javax.swing.plaf.synth;
27
28 import javax.swing.*;
29 import javax.swing.plaf.ComboBoxUI;
30 import javax.swing.plaf.basic.BasicComboPopup;
31 import java.awt.*;
32
33
34 /**
35 * Synth's ComboPopup.
36 *
37 * @author Scott Violet
38 */
39 @SuppressWarnings("serial") // Superclass is not serializable across versions
40 class SynthComboPopup extends BasicComboPopup {
41 public SynthComboPopup( JComboBox combo ) {
42 super(combo);
43 }
44
45 /**
46 * Configures the list which is used to hold the combo box items in the
47 * popup. This method is called when the UI class
48 * is created.
49 *
50 * @see #createList
51 */
52 @Override
53 protected void configureList() {
54 list.setFont( comboBox.getFont() );
55 list.setCellRenderer( comboBox.getRenderer() );
56 list.setFocusable( false );
57 list.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
58 int selectedIndex = comboBox.getSelectedIndex();
59 if ( selectedIndex == -1 ) {
60 list.clearSelection();
61 }
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package javax.swing.plaf.synth;
27
28 import javax.swing.*;
29 import javax.swing.plaf.ComboBoxUI;
30 import javax.swing.plaf.basic.BasicComboPopup;
31 import java.awt.*;
32
33
34 /**
35 * Synth's ComboPopup.
36 *
37 * @author Scott Violet
38 */
39 @SuppressWarnings("serial") // Superclass is not serializable across versions
40 class SynthComboPopup extends BasicComboPopup {
41 public SynthComboPopup( JComboBox<Object> combo ) {
42 super(combo);
43 }
44
45 /**
46 * Configures the list which is used to hold the combo box items in the
47 * popup. This method is called when the UI class
48 * is created.
49 *
50 * @see #createList
51 */
52 @Override
53 protected void configureList() {
54 list.setFont( comboBox.getFont() );
55 list.setCellRenderer( comboBox.getRenderer() );
56 list.setFocusable( false );
57 list.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
58 int selectedIndex = comboBox.getSelectedIndex();
59 if ( selectedIndex == -1 ) {
60 list.clearSelection();
61 }
|