com.sun.java.swing.plaf.windows.WindowsComboBoxUI.WindowsComboBoxEditor Java Examples
The following examples show how to use
com.sun.java.swing.plaf.windows.WindowsComboBoxUI.WindowsComboBoxEditor.
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 File: Test8015300.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
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 File: Test8015300.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
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 File: Test8015300.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
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 File: Test8015300.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
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
Source File: Test8015300.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
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 File: Test8015300.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
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 File: Test8015300.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
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 File: Test8015300.java From hottub with GNU General Public License v2.0 | 4 votes |
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 File: Test8015300.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
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 File: Test8015300.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
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 File: Test8015300.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
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 File: Test8015300.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
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 File: Test8015300.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
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(); } }); } }