1 /*
2 * Copyright (c) 2007, 2014, 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.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
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 */
35 public class HeadlessComponent {
36 public static void main(String args[]) {
37 Component comp = new Component(){};
38 comp.addComponentListener(new ComponentAdapter() {});
39 comp.addFocusListener(new FocusAdapter(){});
40 comp.addHierarchyBoundsListener(new HierarchyBoundsAdapter(){});
41 comp.addHierarchyListener(e -> {});
42 comp.addInputMethodListener(new InputMethodListener() {
43 public void inputMethodTextChanged(InputMethodEvent event) {}
44 public void caretPositionChanged(InputMethodEvent event) {}
45 });
46 comp.addKeyListener(new KeyAdapter() {});
47 comp.addMouseListener(new MouseAdapter() {});
48 comp.addMouseMotionListener(new MouseMotionAdapter() {});
49 comp.addMouseWheelListener(e -> {});
50 comp.addPropertyChangeListener(e -> {});
51 comp.addNotify();
52 comp.getName();
53 comp.setName("goober");
54 comp.getParent();
55 comp.getPeer();
56 comp.getGraphicsConfiguration();
57 comp.getTreeLock();
58 comp.getToolkit();
59 comp.isValid();
60 comp.isDisplayable();
61 comp.isVisible();
62 comp.isShowing();
63 comp.isEnabled();
64 comp.setEnabled(false);
65 comp.setEnabled(true);
66 comp.enable();
67 comp.enable(false);
68 comp.enable(true);
69 comp.disable();
70 comp.isDoubleBuffered();
71 comp.enableInputMethods(false);
72 comp.enableInputMethods(true);
73 comp.setVisible(false);
74 comp.setVisible(true);
75 comp.show();
|
1 /*
2 * Copyright (c) 2007, 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.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
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 */
35 public class HeadlessComponent {
36 public static void main(String args[]) {
37 Component comp = new Component(){};
38 comp.addComponentListener(new ComponentAdapter() {});
39 comp.addFocusListener(new FocusAdapter(){});
40 comp.addHierarchyBoundsListener(new HierarchyBoundsAdapter(){});
41 comp.addHierarchyListener(e -> {});
42 comp.addInputMethodListener(new InputMethodListener() {
43 public void inputMethodTextChanged(InputMethodEvent event) {}
44 public void caretPositionChanged(InputMethodEvent event) {}
45 });
46 comp.addKeyListener(new KeyAdapter() {});
47 comp.addMouseListener(new MouseAdapter() {});
48 comp.addMouseMotionListener(new MouseMotionAdapter() {});
49 comp.addMouseWheelListener(e -> {});
50 comp.addPropertyChangeListener(e -> {});
51 comp.addNotify();
52 comp.getName();
53 comp.setName("goober");
54 comp.getParent();
55 comp.getGraphicsConfiguration();
56 comp.getTreeLock();
57 comp.getToolkit();
58 comp.isValid();
59 comp.isDisplayable();
60 comp.isVisible();
61 comp.isShowing();
62 comp.isEnabled();
63 comp.setEnabled(false);
64 comp.setEnabled(true);
65 comp.enable();
66 comp.enable(false);
67 comp.enable(true);
68 comp.disable();
69 comp.isDoubleBuffered();
70 comp.enableInputMethods(false);
71 comp.enableInputMethods(true);
72 comp.setVisible(false);
73 comp.setVisible(true);
74 comp.show();
|