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(); 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 } | 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 private static final KeyboardFocusManagerPeer kfmPeer = new KeyboardFocusManagerPeer() { 48 public void setCurrentFocusedWindow(Window win) {} 49 public Window getCurrentFocusedWindow() { return null; } 50 public void setCurrentFocusOwner(Component comp) {} 51 public Component getCurrentFocusOwner() { return null; } 52 public void clearGlobalFocusOwner(Window activeWindow) {} 53 }; 54 55 public HToolkit() { 56 } 57 58 /* 59 * Component peer objects - unsupported. 60 */ 61 62 public WindowPeer createWindow(Window target) 63 throws HeadlessException { 64 throw new HeadlessException(); 65 } 66 67 public FramePeer createFrame(Frame target) 68 throws HeadlessException { 69 throw new HeadlessException(); 70 } 71 72 public DialogPeer createDialog(Dialog target) 73 throws HeadlessException { 74 throw new HeadlessException(); 143 throws HeadlessException { 144 throw new HeadlessException(); 145 } 146 147 public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) 148 throws HeadlessException { 149 throw new HeadlessException(); 150 } 151 152 public DragSourceContextPeer createDragSourceContextPeer( 153 DragGestureEvent dge) 154 throws InvalidDnDOperationException { 155 throw new InvalidDnDOperationException("Headless environment"); 156 } 157 158 public RobotPeer createRobot(Robot target, GraphicsDevice screen) 159 throws AWTException, HeadlessException { 160 throw new HeadlessException(); 161 } 162 163 public KeyboardFocusManagerPeer getKeyboardFocusManagerPeer() { 164 // See 6833019. 165 return kfmPeer; 166 } 167 168 public TrayIconPeer createTrayIcon(TrayIcon target) 169 throws HeadlessException { 170 throw new HeadlessException(); 171 } 172 173 public SystemTrayPeer createSystemTray(SystemTray target) 174 throws HeadlessException { 175 throw new HeadlessException(); 176 } 177 178 public boolean isTraySupported() { 179 return false; 180 } 181 182 public GlobalCursorManager getGlobalCursorManager() 183 throws HeadlessException { 184 throw new HeadlessException(); 185 } |