18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.awt.Component;
25 import javax.swing.GroupLayout;
26 import javax.swing.JComboBox;
27 import javax.swing.JFrame;
28 import javax.swing.JLabel;
29 import javax.swing.JList;
30 import javax.swing.JPanel;
31 import javax.swing.ListCellRenderer;
32 import javax.swing.plaf.basic.BasicComboBoxRenderer;
33
34 import static javax.swing.SwingUtilities.invokeAndWait;
35
36 /*
37 * @test
38 * @bug 7195179
39 * @summary Tests that combobox works with generified renderers
40 * @author Sergey Malenkov
41 */
42
43 public class Test7195179 {
44 public static void main(String[] args) throws Exception {
45 invokeAndWait(new Runnable() {
46 @Override
47 public void run() {
48 Integer[] items = {null, 1, 2, 3};
49 JComboBox<Integer> combo = new JComboBox<>(items);
50 JLabel label = new JLabel("choose:");
51 JPanel panel = new JPanel();
52 GroupLayout layout = new GroupLayout(panel);
53 panel.setLayout(layout);
54 label.setLabelFor(combo);
55 combo.setSelectedIndex(0);
56 combo.setRenderer(new ListCellRenderer<Integer>() {
57 private final BasicComboBoxRenderer renderer = new BasicComboBoxRenderer();
|
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.awt.Component;
25 import javax.swing.GroupLayout;
26 import javax.swing.JComboBox;
27 import javax.swing.JFrame;
28 import javax.swing.JLabel;
29 import javax.swing.JList;
30 import javax.swing.JPanel;
31 import javax.swing.ListCellRenderer;
32 import javax.swing.plaf.basic.BasicComboBoxRenderer;
33
34 import static javax.swing.SwingUtilities.invokeAndWait;
35
36 /*
37 * @test
38 * @key headful
39 * @bug 7195179
40 * @summary Tests that combobox works with generified renderers
41 * @author Sergey Malenkov
42 */
43
44 public class Test7195179 {
45 public static void main(String[] args) throws Exception {
46 invokeAndWait(new Runnable() {
47 @Override
48 public void run() {
49 Integer[] items = {null, 1, 2, 3};
50 JComboBox<Integer> combo = new JComboBox<>(items);
51 JLabel label = new JLabel("choose:");
52 JPanel panel = new JPanel();
53 GroupLayout layout = new GroupLayout(panel);
54 panel.setLayout(layout);
55 label.setLabelFor(combo);
56 combo.setSelectedIndex(0);
57 combo.setRenderer(new ListCellRenderer<Integer>() {
58 private final BasicComboBoxRenderer renderer = new BasicComboBoxRenderer();
|