Search in sources :

Example 1 with ComboBoxUI

use of javax.swing.plaf.ComboBoxUI in project android by JetBrains.

the class GradleEditorComboBoxEditor method getComboboxPopup.

@Nullable
private static ComboPopup getComboboxPopup(final JComboBox comboBox) {
    final ComboBoxUI ui = comboBox.getUI();
    ComboPopup popup = null;
    if (ui instanceof BasicComboBoxUI) {
        try {
            final Field popupField = BasicComboBoxUI.class.getDeclaredField("popup");
            popupField.setAccessible(true);
            popup = (ComboPopup) popupField.get(ui);
        } catch (NoSuchFieldException e1) {
            popup = null;
        } catch (IllegalAccessException e1) {
            popup = null;
        }
    }
    return popup;
}
Also used : Field(java.lang.reflect.Field) ComboPopup(javax.swing.plaf.basic.ComboPopup) BasicComboBoxUI(javax.swing.plaf.basic.BasicComboBoxUI) ComboBoxUI(javax.swing.plaf.ComboBoxUI) BasicComboBoxUI(javax.swing.plaf.basic.BasicComboBoxUI) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with ComboBoxUI

use of javax.swing.plaf.ComboBoxUI in project intellij-community by JetBrains.

the class FixedComboBoxEditor method getComboboxPopup.

@Nullable
private static ComboPopup getComboboxPopup(final JComboBox comboBox) {
    final ComboBoxUI ui = comboBox.getUI();
    ComboPopup popup = null;
    if (ui instanceof BasicComboBoxUI) {
        popup = ReflectionUtil.getField(BasicComboBoxUI.class, ui, ComboPopup.class, "popup");
    }
    return popup;
}
Also used : ComboPopup(javax.swing.plaf.basic.ComboPopup) BasicComboBoxUI(javax.swing.plaf.basic.BasicComboBoxUI) ComboBoxUI(javax.swing.plaf.ComboBoxUI) BasicComboBoxUI(javax.swing.plaf.basic.BasicComboBoxUI) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

ComboBoxUI (javax.swing.plaf.ComboBoxUI)2 BasicComboBoxUI (javax.swing.plaf.basic.BasicComboBoxUI)2 ComboPopup (javax.swing.plaf.basic.ComboPopup)2 Nullable (org.jetbrains.annotations.Nullable)2 Field (java.lang.reflect.Field)1