Showing the changes to java/pkg/sun/awt/HToolkit.java (1 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,378 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 2011, 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 | |
| 23 | + * questions. | |
| 24 | + */ | |
| 25 | + | |
| 26 | +package sun.awt; | |
| 27 | + | |
| 28 | +import java.awt.*; | |
| 29 | +import java.awt.dnd.*; | |
| 30 | +import java.awt.dnd.peer.DragSourceContextPeer; | |
| 31 | +import java.awt.im.InputMethodHighlight; | |
| 32 | +import java.awt.im.spi.InputMethodDescriptor; | |
| 33 | +import java.awt.image.*; | |
| 34 | +import java.awt.datatransfer.Clipboard; | |
| 35 | +import java.awt.peer.*; | |
| 36 | +import java.util.Map; | |
| 37 | +import java.util.Properties; | |
| 38 | + | |
| 39 | +/* | |
| 40 | + * HToolkit is a platform independent Toolkit used | |
| 41 | + * with the HeadlessToolkit. It is primarily used | |
| 42 | + * in embedded JRE's that do not have sun/awt/X11 classes. | |
| 43 | + */ | |
| 44 | +public class HToolkit extends SunToolkit | |
| 45 | + implements ComponentFactory { | |
| 46 | + | |
| 47 | + public HToolkit() { | |
| 48 | + } | |
| 49 | + | |
| 50 | + /* | |
| 51 | + * Component peer objects - unsupported. | |
| 52 | + */ | |
| 53 | + | |
| 54 | + public WindowPeer createWindow(Window target) | |
| 55 | + throws HeadlessException { | |
| 56 | + throw new HeadlessException(); | |
| 57 | + } | |
| 58 | + | |
| 59 | + public FramePeer createFrame(Frame target) | |
| 60 | + throws HeadlessException { | |
| 61 | + throw new HeadlessException(); | |
| 62 | + } | |
| 63 | + | |
| 64 | + public DialogPeer createDialog(Dialog target) | |
| 65 | + throws HeadlessException { | |
| 66 | + throw new HeadlessException(); | |
| 67 | + } | |
| 68 | + | |
| 69 | + public ButtonPeer createButton(Button target) | |
| 70 | + throws HeadlessException { | |
| 71 | + throw new HeadlessException(); | |
| 72 | + } | |
| 73 | + | |
| 74 | + public TextFieldPeer createTextField(TextField target) | |
| 75 | + throws HeadlessException { | |
| 76 | + throw new HeadlessException(); | |
| 77 | + } | |
| 78 | + | |
| 79 | + public ChoicePeer createChoice(Choice target) | |
| 80 | + throws HeadlessException { | |
| 81 | + throw new HeadlessException(); | |
| 82 | + } | |
| 83 | + | |
| 84 | + public LabelPeer createLabel(Label target) | |
| 85 | + throws HeadlessException { | |
| 86 | + throw new HeadlessException(); | |
| 87 | + } | |
| 88 | + | |
| 89 | + public ListPeer createList(List target) | |
| 90 | + throws HeadlessException { | |
| 91 | + throw new HeadlessException(); | |
| 92 | + } | |
| 93 | + | |
| 94 | + public CheckboxPeer createCheckbox(Checkbox target) | |
| 95 | + throws HeadlessException { | |
| 96 | + throw new HeadlessException(); | |
| 97 | + } | |
| 98 | + | |
| 99 | + public ScrollbarPeer createScrollbar(Scrollbar target) | |
| 100 | + throws HeadlessException { | |
| 101 | + throw new HeadlessException(); | |
| 102 | + } | |
| 103 | + | |
| 104 | + public ScrollPanePeer createScrollPane(ScrollPane target) | |
| 105 | + throws HeadlessException { | |
| 106 | + throw new HeadlessException(); | |
| 107 | + } | |
| 108 | + | |
| 109 | + public TextAreaPeer createTextArea(TextArea target) | |
| 110 | + throws HeadlessException { | |
| 111 | + throw new HeadlessException(); | |
| 112 | + } | |
| 113 | + | |
| 114 | + public FileDialogPeer createFileDialog(FileDialog target) | |
| 115 | + throws HeadlessException { | |
| 116 | + throw new HeadlessException(); | |
| 117 | + } | |
| 118 | + | |
| 119 | + public MenuBarPeer createMenuBar(MenuBar target) | |
| 120 | + throws HeadlessException { | |
| 121 | + throw new HeadlessException(); | |
| 122 | + } | |
| 123 | + | |
| 124 | + public MenuPeer createMenu(Menu target) | |
| 125 | + throws HeadlessException { | |
| 126 | + throw new HeadlessException(); | |
| 127 | + } | |
| 128 | + | |
| 129 | + public PopupMenuPeer createPopupMenu(PopupMenu target) | |
| 130 | + throws HeadlessException { | |
| 131 | + throw new HeadlessException(); | |
| 132 | + } | |
| 133 | + | |
| 134 | + public MenuItemPeer createMenuItem(MenuItem target) | |
| 135 | + throws HeadlessException { | |
| 136 | + throw new HeadlessException(); | |
| 137 | + } | |
| 138 | + | |
| 139 | + public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) | |
| 140 | + throws HeadlessException { | |
| 141 | + throw new HeadlessException(); | |
| 142 | + } | |
| 143 | + | |
| 144 | + public DragSourceContextPeer createDragSourceContextPeer( | |
| 145 | + DragGestureEvent dge) | |
| 146 | + throws InvalidDnDOperationException { | |
| 147 | + throw new InvalidDnDOperationException("Headless environment"); | |
| 148 | + } | |
| 149 | + | |
| 150 | + public RobotPeer createRobot(Robot target, GraphicsDevice screen) | |
| 151 | + throws AWTException, HeadlessException { | |
| 152 | + throw new HeadlessException(); | |
| 153 | + } | |
| 154 | + | |
| 155 | + public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager) { | |
| 156 | + // See 6833019. | |
| 157 | + return | |
| 158 | + new KeyboardFocusManagerPeer() { | |
| 159 | + public Window getCurrentFocusedWindow() { return null; } | |
| 160 | + public void setCurrentFocusOwner(Component comp) {} | |
| 161 | + public Component getCurrentFocusOwner() { return null; } | |
| 162 | + public void clearGlobalFocusOwner(Window activeWindow) {} | |
| 163 | + }; | |
| 164 | + } | |
| 165 | + | |
| 166 | + public TrayIconPeer createTrayIcon(TrayIcon target) | |
| 167 | + throws HeadlessException { | |
| 168 | + throw new HeadlessException(); | |
| 169 | + } | |
| 170 | + | |
| 171 | + public SystemTrayPeer createSystemTray(SystemTray target) | |
| 172 | + throws HeadlessException { | |
| 173 | + throw new HeadlessException(); | |
| 174 | + } | |
| 175 | + | |
| 176 | + public boolean isTraySupported() { | |
| 177 | + return false; | |
| 178 | + } | |
| 179 | + | |
| 180 | + public GlobalCursorManager getGlobalCursorManager() | |
| 181 | + throws HeadlessException { | |
| 182 | + throw new HeadlessException(); | |
| 183 | + } | |
| 184 | + | |
| 185 | + /* | |
| 186 | + * Headless toolkit - unsupported. | |
| 187 | + */ | |
| 188 | + protected void loadSystemColors(int[] systemColors) | |
| 189 | + throws HeadlessException { | |
| 190 | + throw new HeadlessException(); | |
| 191 | + } | |
| 192 | + | |
| 193 | + public ColorModel getColorModel() | |
| 194 | + throws HeadlessException { | |
| 195 | + throw new HeadlessException(); | |
| 196 | + } | |
| 197 | + | |
| 198 | + public int getScreenResolution() | |
| 199 | + throws HeadlessException { | |
| 200 | + throw new HeadlessException(); | |
| 201 | + } | |
| 202 | + | |
| 203 | + public Map mapInputMethodHighlight(InputMethodHighlight highlight) | |
| 204 | + throws HeadlessException { | |
| 205 | + throw new HeadlessException(); | |
| 206 | + } | |
| 207 | + | |
| 208 | + public int getMenuShortcutKeyMask() | |
| 209 | + throws HeadlessException { | |
| 210 | + throw new HeadlessException(); | |
| 211 | + } | |
| 212 | + | |
| 213 | + public boolean getLockingKeyState(int keyCode) | |
| 214 | + throws UnsupportedOperationException { | |
| 215 | + throw new HeadlessException(); | |
| 216 | + } | |
| 217 | + | |
| 218 | + public void setLockingKeyState(int keyCode, boolean on) | |
| 219 | + throws UnsupportedOperationException { | |
| 220 | + throw new HeadlessException(); | |
| 221 | + } | |
| 222 | + | |
| 223 | + public Cursor createCustomCursor(Image cursor, Point hotSpot, String name) | |
| 224 | + throws IndexOutOfBoundsException, HeadlessException { | |
| 225 | + throw new HeadlessException(); | |
| 226 | + } | |
| 227 | + | |
| 228 | + public Dimension getBestCursorSize(int preferredWidth, int preferredHeight) | |
| 229 | + throws HeadlessException { | |
| 230 | + throw new HeadlessException(); | |
| 231 | + } | |
| 232 | + | |
| 233 | + public int getMaximumCursorColors() | |
| 234 | + throws HeadlessException { | |
| 235 | + throw new HeadlessException(); | |
| 236 | + } | |
| 237 | + | |
| 238 | + public <T extends DragGestureRecognizer> T | |
| 239 | + createDragGestureRecognizer(Class<T> abstractRecognizerClass, | |
| 240 | + DragSource ds, Component c, | |
| 241 | + int srcActions, DragGestureListener dgl) | |
| 242 | + { | |
| 243 | + return null; | |
| 244 | + } | |
| 245 | + | |
| 246 | + public int getScreenHeight() | |
| 247 | + throws HeadlessException { | |
| 248 | + throw new HeadlessException(); | |
| 249 | + } | |
| 250 | + | |
| 251 | + public int getScreenWidth() | |
| 252 | + throws HeadlessException { | |
| 253 | + throw new HeadlessException(); | |
| 254 | + } | |
| 255 | + | |
| 256 | + public Dimension getScreenSize() | |
| 257 | + throws HeadlessException { | |
| 258 | + throw new HeadlessException(); | |
| 259 | + } | |
| 260 | + | |
| 261 | + public Insets getScreenInsets(GraphicsConfiguration gc) | |
| 262 | + throws HeadlessException { | |
| 263 | + throw new HeadlessException(); | |
| 264 | + } | |
| 265 | + | |
| 266 | + public void setDynamicLayout(boolean dynamic) | |
| 267 | + throws HeadlessException { | |
| 268 | + throw new HeadlessException(); | |
| 269 | + } | |
| 270 | + | |
| 271 | + protected boolean isDynamicLayoutSet() | |
| 272 | + throws HeadlessException { | |
| 273 | + throw new HeadlessException(); | |
| 274 | + } | |
| 275 | + | |
| 276 | + public boolean isDynamicLayoutActive() | |
| 277 | + throws HeadlessException { | |
| 278 | + throw new HeadlessException(); | |
| 279 | + } | |
| 280 | + | |
| 281 | + public Clipboard getSystemClipboard() | |
| 282 | + throws HeadlessException { | |
| 283 | + throw new HeadlessException(); | |
| 284 | + } | |
| 285 | + | |
| 286 | + /* | |
| 287 | + * Printing | |
| 288 | + */ | |
| 289 | + public PrintJob getPrintJob(Frame frame, String jobtitle, | |
| 290 | + JobAttributes jobAttributes, | |
| 291 | + PageAttributes pageAttributes) { | |
| 292 | + if (frame != null) { | |
| 293 | + // Should never happen | |
| 294 | + throw new HeadlessException(); | |
| 295 | + } | |
| 296 | + throw new IllegalArgumentException( | |
| 297 | + "PrintJob not supported in a headless environment"); | |
| 298 | + } | |
| 299 | + | |
| 300 | + public PrintJob getPrintJob(Frame frame, String doctitle, Properties props) | |
| 301 | + { | |
| 302 | + if (frame != null) { | |
| 303 | + // Should never happen | |
| 304 | + throw new HeadlessException(); | |
| 305 | + } | |
| 306 | + throw new IllegalArgumentException( | |
| 307 | + "PrintJob not supported in a headless environment"); | |
| 308 | + } | |
| 309 | + | |
| 310 | + /* | |
| 311 | + * Headless toolkit - supported. | |
| 312 | + */ | |
| 313 | + | |
| 314 | + public void sync() { | |
| 315 | + // Do nothing | |
| 316 | + } | |
| 317 | + | |
| 318 | + protected boolean syncNativeQueue(final long timeout) { | |
| 319 | + return false; | |
| 320 | + } | |
| 321 | + | |
| 322 | + public void beep() { | |
| 323 | + // Send alert character | |
| 324 | + System.out.write(0x07); | |
| 325 | + } | |
| 326 | + | |
| 327 | + | |
| 328 | + /* | |
| 329 | + * Fonts | |
| 330 | + */ | |
| 331 | + public FontPeer getFontPeer(String name, int style) { | |
| 332 | + return (FontPeer)null; | |
| 333 | + } | |
| 334 | + | |
| 335 | + /* | |
| 336 | + * Modality | |
| 337 | + */ | |
| 338 | + public boolean isModalityTypeSupported(Dialog.ModalityType modalityType) { | |
| 339 | + return false; | |
| 340 | + } | |
| 341 | + | |
| 342 | + public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType exclusionType) { | |
| 343 | + return false; | |
| 344 | + } | |
| 345 | + | |
| 346 | + public boolean isDesktopSupported() { | |
| 347 | + return false; | |
| 348 | + } | |
| 349 | + | |
| 350 | + public DesktopPeer createDesktopPeer(Desktop target) | |
| 351 | + throws HeadlessException{ | |
| 352 | + throw new HeadlessException(); | |
| 353 | + } | |
| 354 | + | |
| 355 | + public boolean isWindowOpacityControlSupported() { | |
| 356 | + return false; | |
| 357 | + } | |
| 358 | + | |
| 359 | + public boolean isWindowShapingSupported() { | |
| 360 | + return false; | |
| 361 | + } | |
| 362 | + | |
| 363 | + public boolean isWindowTranslucencySupported() { | |
| 364 | + return false; | |
| 365 | + } | |
| 366 | + | |
| 367 | + public void grab(Window w) { } | |
| 368 | + | |
| 369 | + public void ungrab(Window w) { } | |
| 370 | + | |
| 371 | + protected boolean syncNativeQueue() { return false; } | |
| 372 | + | |
| 373 | + public InputMethodDescriptor getInputMethodAdapterDescriptor() | |
| 374 | + throws AWTException | |
| 375 | + { | |
| 376 | + return (InputMethodDescriptor)null; | |
| 377 | + } | |
| 378 | +} | |