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
23 * questions.
24 */
25
26 package sun.awt;
27
28 import java.awt.*;
29 import java.awt.dnd.DragGestureEvent;
30 import java.awt.dnd.InvalidDnDOperationException;
31 import java.awt.dnd.peer.DragSourceContextPeer;
32 import java.awt.peer.*;
33
34 import sun.awt.datatransfer.DataTransferer;
35
36 final class LightweightPeerHolder {
37 static final LightweightPeer lightweightMarker = new NullComponentPeer();
38
39 private LightweightPeerHolder() {
40 }
41 }
42
43 /**
44 * Interface for component creation support in toolkits.
45 */
46 public interface ComponentFactory {
47
54 * @return the peer for the specified component
55 */
56 default LightweightPeer createComponent(Component target) {
57 return LightweightPeerHolder.lightweightMarker;
58 }
59
60 /**
61 * Creates this toolkit's implementation of the {@code Desktop} using the
62 * specified peer interface.
63 *
64 * @param target the desktop to be implemented
65 * @return this toolkit's implementation of the {@code Desktop}
66 * @throws HeadlessException if GraphicsEnvironment.isHeadless() returns
67 * true
68 * @see java.awt.GraphicsEnvironment#isHeadless
69 * @see java.awt.Desktop
70 * @see java.awt.peer.DesktopPeer
71 * @since 1.6
72 */
73 default DesktopPeer createDesktopPeer(Desktop target) {
74 throw new HeadlessException();
75 }
76
77 /**
78 * Creates this toolkit's implementation of {@code Button} using the
79 * specified peer interface.
80 *
81 * @param target the button to be implemented
82 * @return this toolkit's implementation of {@code Button}
83 * @throws HeadlessException if GraphicsEnvironment.isHeadless() returns
84 * true
85 * @see java.awt.GraphicsEnvironment#isHeadless
86 * @see java.awt.Button
87 * @see java.awt.peer.ButtonPeer
88 */
89 default ButtonPeer createButton(Button target) {
90 throw new HeadlessException();
91 }
92
93 /**
|
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
23 * questions.
24 */
25
26 package sun.awt;
27
28 import java.awt.peer.TaskbarPeer;
29 import java.awt.*;
30 import java.awt.dnd.DragGestureEvent;
31 import java.awt.dnd.InvalidDnDOperationException;
32 import java.awt.dnd.peer.DragSourceContextPeer;
33 import java.awt.peer.*;
34
35 import sun.awt.datatransfer.DataTransferer;
36
37 final class LightweightPeerHolder {
38 static final LightweightPeer lightweightMarker = new NullComponentPeer();
39
40 private LightweightPeerHolder() {
41 }
42 }
43
44 /**
45 * Interface for component creation support in toolkits.
46 */
47 public interface ComponentFactory {
48
55 * @return the peer for the specified component
56 */
57 default LightweightPeer createComponent(Component target) {
58 return LightweightPeerHolder.lightweightMarker;
59 }
60
61 /**
62 * Creates this toolkit's implementation of the {@code Desktop} using the
63 * specified peer interface.
64 *
65 * @param target the desktop to be implemented
66 * @return this toolkit's implementation of the {@code Desktop}
67 * @throws HeadlessException if GraphicsEnvironment.isHeadless() returns
68 * true
69 * @see java.awt.GraphicsEnvironment#isHeadless
70 * @see java.awt.Desktop
71 * @see java.awt.peer.DesktopPeer
72 * @since 1.6
73 */
74 default DesktopPeer createDesktopPeer(Desktop target) {
75 throw new HeadlessException();
76 }
77
78 /**
79 * Creates this toolkit's implementation of the {@code Taskbar} using the
80 * specified peer interface.
81 *
82 * @param target the taskbar to be implemented
83 * @return this toolkit's implementation of the {@code Taskbar}
84 * @throws HeadlessException if GraphicsEnvironment.isHeadless() returns
85 * true
86 * @see java.awt.GraphicsEnvironment#isHeadless
87 * @see java.awt.Taskbar
88 * @see java.awt.peer.TaskbarPeer
89 * @since 1.9
90 */
91 default TaskbarPeer createTaskbarPeer(Taskbar target) {
92 throw new HeadlessException();
93 }
94
95 /**
96 * Creates this toolkit's implementation of {@code Button} using the
97 * specified peer interface.
98 *
99 * @param target the button to be implemented
100 * @return this toolkit's implementation of {@code Button}
101 * @throws HeadlessException if GraphicsEnvironment.isHeadless() returns
102 * true
103 * @see java.awt.GraphicsEnvironment#isHeadless
104 * @see java.awt.Button
105 * @see java.awt.peer.ButtonPeer
106 */
107 default ButtonPeer createButton(Button target) {
108 throw new HeadlessException();
109 }
110
111 /**
|