Java Code Examples for com.sun.java.swing.plaf.windows.WindowsComboBoxUI.WindowsComboBoxEditor

The following examples show how to use com.sun.java.swing.plaf.windows.WindowsComboBoxUI.WindowsComboBoxEditor. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: dragonwell8_jdk   Source File: Test8015300.java    License: GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.LookAndFeelInfo[] array = UIManager.getInstalledLookAndFeels();
    for (UIManager.LookAndFeelInfo info : array) {
        UIManager.setLookAndFeel(info.getClassName());
        System.err.println("L&F: " + info.getName());
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                combo = new JComboBox<>(ITEMS);
                combo.addItemListener(new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent event) {
                        if (ItemEvent.SELECTED == event.getStateChange() && combo.isEditable()) {
                            ComboBoxEditor editor = combo.getEditor();
                            Object component = editor.getEditorComponent();
                            if (component instanceof JTextField) {
                                JTextField text = (JTextField) component;
                                boolean selected = null != text.getSelectedText();

                                StringBuilder sb = new StringBuilder();
                                sb.append(" - ").append(combo.getSelectedIndex());
                                sb.append(": ").append(event.getItem());
                                if (selected) {
                                    sb.append("; selected");
                                }
                                System.err.println(sb);
                                if ((editor instanceof WindowsComboBoxEditor) == (null == text.getSelectedText())) {
                                    throw new Error("unexpected state of text selection");
                                }
                            }
                        }
                    }
                });
                JFrame frame = new JFrame(getClass().getSimpleName());
                frame.add(combo);
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
                frame.setVisible(true);
            }
        });
        for (int i = 0; i < ITEMS.length; ++i) {
            select(i, true);
            select(1, false);
        }
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                windowForComponent(combo).dispose();
            }
        });
    }
}
 
Example 2
Source Project: TencentKona-8   Source File: Test8015300.java    License: GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.LookAndFeelInfo[] array = UIManager.getInstalledLookAndFeels();
    for (UIManager.LookAndFeelInfo info : array) {
        UIManager.setLookAndFeel(info.getClassName());
        System.err.println("L&F: " + info.getName());
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                combo = new JComboBox<>(ITEMS);
                combo.addItemListener(new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent event) {
                        if (ItemEvent.SELECTED == event.getStateChange() && combo.isEditable()) {
                            ComboBoxEditor editor = combo.getEditor();
                            Object component = editor.getEditorComponent();
                            if (component instanceof JTextField) {
                                JTextField text = (JTextField) component;
                                boolean selected = null != text.getSelectedText();

                                StringBuilder sb = new StringBuilder();
                                sb.append(" - ").append(combo.getSelectedIndex());
                                sb.append(": ").append(event.getItem());
                                if (selected) {
                                    sb.append("; selected");
                                }
                                System.err.println(sb);
                                if ((editor instanceof WindowsComboBoxEditor) == (null == text.getSelectedText())) {
                                    throw new Error("unexpected state of text selection");
                                }
                            }
                        }
                    }
                });
                JFrame frame = new JFrame(getClass().getSimpleName());
                frame.add(combo);
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
                frame.setVisible(true);
            }
        });
        for (int i = 0; i < ITEMS.length; ++i) {
            select(i, true);
            select(1, false);
        }
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                windowForComponent(combo).dispose();
            }
        });
    }
}
 
Example 3
Source Project: jdk8u60   Source File: Test8015300.java    License: GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.LookAndFeelInfo[] array = UIManager.getInstalledLookAndFeels();
    for (UIManager.LookAndFeelInfo info : array) {
        UIManager.setLookAndFeel(info.getClassName());
        System.err.println("L&F: " + info.getName());
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                combo = new JComboBox<>(ITEMS);
                combo.addItemListener(new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent event) {
                        if (ItemEvent.SELECTED == event.getStateChange() && combo.isEditable()) {
                            ComboBoxEditor editor = combo.getEditor();
                            Object component = editor.getEditorComponent();
                            if (component instanceof JTextField) {
                                JTextField text = (JTextField) component;
                                boolean selected = null != text.getSelectedText();

                                StringBuilder sb = new StringBuilder();
                                sb.append(" - ").append(combo.getSelectedIndex());
                                sb.append(": ").append(event.getItem());
                                if (selected) {
                                    sb.append("; selected");
                                }
                                System.err.println(sb);
                                if ((editor instanceof WindowsComboBoxEditor) == (null == text.getSelectedText())) {
                                    throw new Error("unexpected state of text selection");
                                }
                            }
                        }
                    }
                });
                JFrame frame = new JFrame(getClass().getSimpleName());
                frame.add(combo);
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
                frame.setVisible(true);
            }
        });
        for (int i = 0; i < ITEMS.length; ++i) {
            select(i, true);
            select(1, false);
        }
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                windowForComponent(combo).dispose();
            }
        });
    }
}
 
Example 4
Source Project: openjdk-jdk8u   Source File: Test8015300.java    License: GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.LookAndFeelInfo[] array = UIManager.getInstalledLookAndFeels();
    for (UIManager.LookAndFeelInfo info : array) {
        UIManager.setLookAndFeel(info.getClassName());
        System.err.println("L&F: " + info.getName());
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                combo = new JComboBox<>(ITEMS);
                combo.addItemListener(new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent event) {
                        if (ItemEvent.SELECTED == event.getStateChange() && combo.isEditable()) {
                            ComboBoxEditor editor = combo.getEditor();
                            Object component = editor.getEditorComponent();
                            if (component instanceof JTextField) {
                                JTextField text = (JTextField) component;
                                boolean selected = null != text.getSelectedText();

                                StringBuilder sb = new StringBuilder();
                                sb.append(" - ").append(combo.getSelectedIndex());
                                sb.append(": ").append(event.getItem());
                                if (selected) {
                                    sb.append("; selected");
                                }
                                System.err.println(sb);
                                if ((editor instanceof WindowsComboBoxEditor) == (null == text.getSelectedText())) {
                                    throw new Error("unexpected state of text selection");
                                }
                            }
                        }
                    }
                });
                JFrame frame = new JFrame(getClass().getSimpleName());
                frame.add(combo);
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
                frame.setVisible(true);
            }
        });
        for (int i = 0; i < ITEMS.length; ++i) {
            select(i, true);
            select(1, false);
        }
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                windowForComponent(combo).dispose();
            }
        });
    }
}
 
Example 5
public static void main(String[] args) throws Exception {
    UIManager.LookAndFeelInfo[] array = UIManager.getInstalledLookAndFeels();
    for (UIManager.LookAndFeelInfo info : array) {
        UIManager.setLookAndFeel(info.getClassName());
        System.err.println("L&F: " + info.getName());
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                combo = new JComboBox<>(ITEMS);
                combo.addItemListener(new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent event) {
                        if (ItemEvent.SELECTED == event.getStateChange() && combo.isEditable()) {
                            ComboBoxEditor editor = combo.getEditor();
                            Object component = editor.getEditorComponent();
                            if (component instanceof JTextField) {
                                JTextField text = (JTextField) component;
                                boolean selected = null != text.getSelectedText();

                                StringBuilder sb = new StringBuilder();
                                sb.append(" - ").append(combo.getSelectedIndex());
                                sb.append(": ").append(event.getItem());
                                if (selected) {
                                    sb.append("; selected");
                                }
                                System.err.println(sb);
                                if ((editor instanceof WindowsComboBoxEditor) == (null == text.getSelectedText())) {
                                    throw new Error("unexpected state of text selection");
                                }
                            }
                        }
                    }
                });
                JFrame frame = new JFrame(getClass().getSimpleName());
                frame.add(combo);
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
                frame.setVisible(true);
            }
        });
        for (int i = 0; i < ITEMS.length; ++i) {
            select(i, true);
            select(1, false);
        }
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                windowForComponent(combo).dispose();
            }
        });
    }
}
 
Example 6
Source Project: openjdk-jdk9   Source File: Test8015300.java    License: GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.LookAndFeelInfo[] array = UIManager.getInstalledLookAndFeels();
    for (UIManager.LookAndFeelInfo info : array) {
        UIManager.setLookAndFeel(info.getClassName());
        System.err.println("L&F: " + info.getName());
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                combo = new JComboBox<>(ITEMS);
                combo.addItemListener(new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent event) {
                        if (ItemEvent.SELECTED == event.getStateChange() && combo.isEditable()) {
                            ComboBoxEditor editor = combo.getEditor();
                            Object component = editor.getEditorComponent();
                            if (component instanceof JTextField) {
                                JTextField text = (JTextField) component;
                                boolean selected = null != text.getSelectedText();

                                StringBuilder sb = new StringBuilder();
                                sb.append(" - ").append(combo.getSelectedIndex());
                                sb.append(": ").append(event.getItem());
                                if (selected) {
                                    sb.append("; selected");
                                }
                                System.err.println(sb);
                                if ((editor instanceof WindowsComboBoxEditor) == (null == text.getSelectedText())) {
                                    throw new Error("unexpected state of text selection");
                                }
                            }
                        }
                    }
                });
                JFrame frame = new JFrame(getClass().getSimpleName());
                frame.add(combo);
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
                frame.setVisible(true);
            }
        });
        for (int i = 0; i < ITEMS.length; ++i) {
            select(i, true);
            select(1, false);
        }
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                windowForComponent(combo).dispose();
            }
        });
    }
}
 
Example 7
Source Project: jdk8u-jdk   Source File: Test8015300.java    License: GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.LookAndFeelInfo[] array = UIManager.getInstalledLookAndFeels();
    for (UIManager.LookAndFeelInfo info : array) {
        UIManager.setLookAndFeel(info.getClassName());
        System.err.println("L&F: " + info.getName());
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                combo = new JComboBox<>(ITEMS);
                combo.addItemListener(new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent event) {
                        if (ItemEvent.SELECTED == event.getStateChange() && combo.isEditable()) {
                            ComboBoxEditor editor = combo.getEditor();
                            Object component = editor.getEditorComponent();
                            if (component instanceof JTextField) {
                                JTextField text = (JTextField) component;
                                boolean selected = null != text.getSelectedText();

                                StringBuilder sb = new StringBuilder();
                                sb.append(" - ").append(combo.getSelectedIndex());
                                sb.append(": ").append(event.getItem());
                                if (selected) {
                                    sb.append("; selected");
                                }
                                System.err.println(sb);
                                if ((editor instanceof WindowsComboBoxEditor) == (null == text.getSelectedText())) {
                                    throw new Error("unexpected state of text selection");
                                }
                            }
                        }
                    }
                });
                JFrame frame = new JFrame(getClass().getSimpleName());
                frame.add(combo);
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
                frame.setVisible(true);
            }
        });
        for (int i = 0; i < ITEMS.length; ++i) {
            select(i, true);
            select(1, false);
        }
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                windowForComponent(combo).dispose();
            }
        });
    }
}
 
Example 8
Source Project: hottub   Source File: Test8015300.java    License: GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.LookAndFeelInfo[] array = UIManager.getInstalledLookAndFeels();
    for (UIManager.LookAndFeelInfo info : array) {
        UIManager.setLookAndFeel(info.getClassName());
        System.err.println("L&F: " + info.getName());
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                combo = new JComboBox<>(ITEMS);
                combo.addItemListener(new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent event) {
                        if (ItemEvent.SELECTED == event.getStateChange() && combo.isEditable()) {
                            ComboBoxEditor editor = combo.getEditor();
                            Object component = editor.getEditorComponent();
                            if (component instanceof JTextField) {
                                JTextField text = (JTextField) component;
                                boolean selected = null != text.getSelectedText();

                                StringBuilder sb = new StringBuilder();
                                sb.append(" - ").append(combo.getSelectedIndex());
                                sb.append(": ").append(event.getItem());
                                if (selected) {
                                    sb.append("; selected");
                                }
                                System.err.println(sb);
                                if ((editor instanceof WindowsComboBoxEditor) == (null == text.getSelectedText())) {
                                    throw new Error("unexpected state of text selection");
                                }
                            }
                        }
                    }
                });
                JFrame frame = new JFrame(getClass().getSimpleName());
                frame.add(combo);
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
                frame.setVisible(true);
            }
        });
        for (int i = 0; i < ITEMS.length; ++i) {
            select(i, true);
            select(1, false);
        }
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                windowForComponent(combo).dispose();
            }
        });
    }
}
 
Example 9
Source Project: openjdk-8-source   Source File: Test8015300.java    License: GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.LookAndFeelInfo[] array = UIManager.getInstalledLookAndFeels();
    for (UIManager.LookAndFeelInfo info : array) {
        UIManager.setLookAndFeel(info.getClassName());
        System.err.println("L&F: " + info.getName());
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                combo = new JComboBox<>(ITEMS);
                combo.addItemListener(new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent event) {
                        if (ItemEvent.SELECTED == event.getStateChange() && combo.isEditable()) {
                            ComboBoxEditor editor = combo.getEditor();
                            Object component = editor.getEditorComponent();
                            if (component instanceof JTextField) {
                                JTextField text = (JTextField) component;
                                boolean selected = null != text.getSelectedText();

                                StringBuilder sb = new StringBuilder();
                                sb.append(" - ").append(combo.getSelectedIndex());
                                sb.append(": ").append(event.getItem());
                                if (selected) {
                                    sb.append("; selected");
                                }
                                System.err.println(sb);
                                if ((editor instanceof WindowsComboBoxEditor) == (null == text.getSelectedText())) {
                                    throw new Error("unexpected state of text selection");
                                }
                            }
                        }
                    }
                });
                JFrame frame = new JFrame(getClass().getSimpleName());
                frame.add(combo);
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
                frame.setVisible(true);
            }
        });
        for (int i = 0; i < ITEMS.length; ++i) {
            select(i, true);
            select(1, false);
        }
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                windowForComponent(combo).dispose();
            }
        });
    }
}
 
Example 10
Source Project: openjdk-8   Source File: Test8015300.java    License: GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.LookAndFeelInfo[] array = UIManager.getInstalledLookAndFeels();
    for (UIManager.LookAndFeelInfo info : array) {
        UIManager.setLookAndFeel(info.getClassName());
        System.err.println("L&F: " + info.getName());
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                combo = new JComboBox<>(ITEMS);
                combo.addItemListener(new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent event) {
                        if (ItemEvent.SELECTED == event.getStateChange() && combo.isEditable()) {
                            ComboBoxEditor editor = combo.getEditor();
                            Object component = editor.getEditorComponent();
                            if (component instanceof JTextField) {
                                JTextField text = (JTextField) component;
                                boolean selected = null != text.getSelectedText();

                                StringBuilder sb = new StringBuilder();
                                sb.append(" - ").append(combo.getSelectedIndex());
                                sb.append(": ").append(event.getItem());
                                if (selected) {
                                    sb.append("; selected");
                                }
                                System.err.println(sb);
                                if ((editor instanceof WindowsComboBoxEditor) == (null == text.getSelectedText())) {
                                    throw new Error("unexpected state of text selection");
                                }
                            }
                        }
                    }
                });
                JFrame frame = new JFrame(getClass().getSimpleName());
                frame.add(combo);
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
                frame.setVisible(true);
            }
        });
        for (int i = 0; i < ITEMS.length; ++i) {
            select(i, true);
            select(1, false);
        }
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                windowForComponent(combo).dispose();
            }
        });
    }
}
 
Example 11
Source Project: jdk8u_jdk   Source File: Test8015300.java    License: GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.LookAndFeelInfo[] array = UIManager.getInstalledLookAndFeels();
    for (UIManager.LookAndFeelInfo info : array) {
        UIManager.setLookAndFeel(info.getClassName());
        System.err.println("L&F: " + info.getName());
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                combo = new JComboBox<>(ITEMS);
                combo.addItemListener(new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent event) {
                        if (ItemEvent.SELECTED == event.getStateChange() && combo.isEditable()) {
                            ComboBoxEditor editor = combo.getEditor();
                            Object component = editor.getEditorComponent();
                            if (component instanceof JTextField) {
                                JTextField text = (JTextField) component;
                                boolean selected = null != text.getSelectedText();

                                StringBuilder sb = new StringBuilder();
                                sb.append(" - ").append(combo.getSelectedIndex());
                                sb.append(": ").append(event.getItem());
                                if (selected) {
                                    sb.append("; selected");
                                }
                                System.err.println(sb);
                                if ((editor instanceof WindowsComboBoxEditor) == (null == text.getSelectedText())) {
                                    throw new Error("unexpected state of text selection");
                                }
                            }
                        }
                    }
                });
                JFrame frame = new JFrame(getClass().getSimpleName());
                frame.add(combo);
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
                frame.setVisible(true);
            }
        });
        for (int i = 0; i < ITEMS.length; ++i) {
            select(i, true);
            select(1, false);
        }
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                windowForComponent(combo).dispose();
            }
        });
    }
}
 
Example 12
Source Project: jdk8u-jdk   Source File: Test8015300.java    License: GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.LookAndFeelInfo[] array = UIManager.getInstalledLookAndFeels();
    for (UIManager.LookAndFeelInfo info : array) {
        UIManager.setLookAndFeel(info.getClassName());
        System.err.println("L&F: " + info.getName());
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                combo = new JComboBox<>(ITEMS);
                combo.addItemListener(new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent event) {
                        if (ItemEvent.SELECTED == event.getStateChange() && combo.isEditable()) {
                            ComboBoxEditor editor = combo.getEditor();
                            Object component = editor.getEditorComponent();
                            if (component instanceof JTextField) {
                                JTextField text = (JTextField) component;
                                boolean selected = null != text.getSelectedText();

                                StringBuilder sb = new StringBuilder();
                                sb.append(" - ").append(combo.getSelectedIndex());
                                sb.append(": ").append(event.getItem());
                                if (selected) {
                                    sb.append("; selected");
                                }
                                System.err.println(sb);
                                if ((editor instanceof WindowsComboBoxEditor) == (null == text.getSelectedText())) {
                                    throw new Error("unexpected state of text selection");
                                }
                            }
                        }
                    }
                });
                JFrame frame = new JFrame(getClass().getSimpleName());
                frame.add(combo);
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
                frame.setVisible(true);
            }
        });
        for (int i = 0; i < ITEMS.length; ++i) {
            select(i, true);
            select(1, false);
        }
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                windowForComponent(combo).dispose();
            }
        });
    }
}
 
Example 13
Source Project: jdk8u-dev-jdk   Source File: Test8015300.java    License: GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.LookAndFeelInfo[] array = UIManager.getInstalledLookAndFeels();
    for (UIManager.LookAndFeelInfo info : array) {
        UIManager.setLookAndFeel(info.getClassName());
        System.err.println("L&F: " + info.getName());
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                combo = new JComboBox<>(ITEMS);
                combo.addItemListener(new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent event) {
                        if (ItemEvent.SELECTED == event.getStateChange() && combo.isEditable()) {
                            ComboBoxEditor editor = combo.getEditor();
                            Object component = editor.getEditorComponent();
                            if (component instanceof JTextField) {
                                JTextField text = (JTextField) component;
                                boolean selected = null != text.getSelectedText();

                                StringBuilder sb = new StringBuilder();
                                sb.append(" - ").append(combo.getSelectedIndex());
                                sb.append(": ").append(event.getItem());
                                if (selected) {
                                    sb.append("; selected");
                                }
                                System.err.println(sb);
                                if ((editor instanceof WindowsComboBoxEditor) == (null == text.getSelectedText())) {
                                    throw new Error("unexpected state of text selection");
                                }
                            }
                        }
                    }
                });
                JFrame frame = new JFrame(getClass().getSimpleName());
                frame.add(combo);
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
                frame.setVisible(true);
            }
        });
        for (int i = 0; i < ITEMS.length; ++i) {
            select(i, true);
            select(1, false);
        }
        invokeAndWait(new Runnable() {
            @Override
            public void run() {
                windowForComponent(combo).dispose();
            }
        });
    }
}