1 /*
2 * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
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
34
35 import javax.accessibility.*;
36
37
38 /**
39 * The {@code Choice} class presents a pop-up menu of choices.
40 * The current choice is displayed as the title of the menu.
41 * <p>
42 * The following code example produces a pop-up menu:
43 *
44 * <hr><blockquote><pre>
45 * Choice ColorChooser = new Choice();
46 * ColorChooser.add("Green");
47 * ColorChooser.add("Red");
48 * ColorChooser.add("Blue");
49 * </pre></blockquote><hr>
50 * <p>
51 * After this choice menu has been added to a panel,
52 * it appears as follows in its normal state:
53 * <p>
54 * <img src="doc-files/Choice-1.gif" alt="The following text describes the graphic"
55 * style="float:center; margin: 7px 10px;">
56 * <p>
57 * In the picture, {@code "Green"} is the current choice.
58 * Pushing the mouse button down on the object causes a menu to
59 * appear with the current choice highlighted.
60 * <p>
61 * Some native platforms do not support arbitrary resizing of
62 * {@code Choice} components and the behavior of
63 * {@code setSize()/getSize()} is bound by
64 * such limitations.
65 * Native GUI {@code Choice} components' size are often bound by such
66 * attributes as font size and length of items contained within
67 * the {@code Choice}.
68 *
69 * @author Sami Shaio
70 * @author Arthur van Hoff
71 * @since 1.0
72 */
73 public class Choice extends Component implements ItemSelectable, Accessible {
74 /**
75 * The items for the {@code Choice}.
|
1 /*
2 * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
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
34
35 import javax.accessibility.*;
36
37
38 /**
39 * The {@code Choice} class presents a pop-up menu of choices.
40 * The current choice is displayed as the title of the menu.
41 * <p>
42 * The following code example produces a pop-up menu:
43 *
44 * <hr><blockquote><pre>
45 * Choice ColorChooser = new Choice();
46 * ColorChooser.add("Green");
47 * ColorChooser.add("Red");
48 * ColorChooser.add("Blue");
49 * </pre></blockquote><hr>
50 * <p>
51 * After this choice menu has been added to a panel,
52 * it appears as follows in its normal state:
53 * <p>
54 * <img src="doc-files/Choice-1.gif" alt="The following text describes the
55 * graphic" style="margin: 7px 10px;">
56 * <p>
57 * In the picture, {@code "Green"} is the current choice.
58 * Pushing the mouse button down on the object causes a menu to
59 * appear with the current choice highlighted.
60 * <p>
61 * Some native platforms do not support arbitrary resizing of
62 * {@code Choice} components and the behavior of
63 * {@code setSize()/getSize()} is bound by
64 * such limitations.
65 * Native GUI {@code Choice} components' size are often bound by such
66 * attributes as font size and length of items contained within
67 * the {@code Choice}.
68 *
69 * @author Sami Shaio
70 * @author Arthur van Hoff
71 * @since 1.0
72 */
73 public class Choice extends Component implements ItemSelectable, Accessible {
74 /**
75 * The items for the {@code Choice}.
|