src/java.desktop/share/classes/sun/awt/HeadlessToolkit.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2012, 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 sun.awt.datatransfer.DataTransferer;
  29 
  30 import java.awt.*;
  31 import java.awt.dnd.*;
  32 import java.awt.dnd.peer.DragSourceContextPeer;
  33 import java.awt.event.*;


  34 import java.awt.font.TextAttribute;
  35 import java.awt.im.InputMethodHighlight;
  36 import java.awt.image.*;
  37 import java.awt.datatransfer.Clipboard;
  38 import java.awt.peer.*;




  39 import java.beans.PropertyChangeListener;
  40 import java.net.URL;
  41 import java.util.Map;
  42 import java.util.Properties;
  43 
  44 public class HeadlessToolkit extends Toolkit
  45     implements ComponentFactory, KeyboardFocusManagerPeerProvider {
  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     private Toolkit tk;
  56     private ComponentFactory componentFactory;
  57 
  58     public HeadlessToolkit(Toolkit tk) {
  59         this.tk = tk;
  60         if (tk instanceof ComponentFactory) {
  61             componentFactory = (ComponentFactory)tk;
  62         }
  63     }
  64 
  65     public Toolkit getUnderlyingToolkit() {
  66         return tk;
  67     }
  68 
  69     /*
  70      * Component peer objects.
  71      */
  72 
  73     /* Lightweight implementation of Canvas and Panel */
  74 
  75     public CanvasPeer createCanvas(Canvas target) {
  76         return (CanvasPeer)createComponent(target);
  77     }
  78 
  79     public PanelPeer createPanel(Panel target) {
  80         return (PanelPeer)createComponent(target);
  81     }
  82 
  83     /*
  84      * Component peer objects - unsupported.
  85      */
  86 
  87     public WindowPeer createWindow(Window target)
  88         throws HeadlessException {
  89         throw new HeadlessException();
  90     }
  91 
  92     public FramePeer createFrame(Frame target)
  93         throws HeadlessException {
  94         throw new HeadlessException();
  95     }
  96 
  97     public DialogPeer createDialog(Dialog target)
  98         throws HeadlessException {
  99         throw new HeadlessException();
 100     }
 101 
 102     public ButtonPeer createButton(Button target)
 103         throws HeadlessException {
 104         throw new HeadlessException();
 105     }
 106 
 107     public TextFieldPeer createTextField(TextField target)
 108         throws HeadlessException {
 109         throw new HeadlessException();
 110     }
 111 
 112     public ChoicePeer createChoice(Choice target)
 113         throws HeadlessException {
 114         throw new HeadlessException();
 115     }
 116 
 117     public LabelPeer createLabel(Label target)
 118         throws HeadlessException {
 119         throw new HeadlessException();
 120     }
 121 
 122     public ListPeer createList(List target)
 123         throws HeadlessException {
 124         throw new HeadlessException();
 125     }
 126 
 127     public CheckboxPeer createCheckbox(Checkbox target)
 128         throws HeadlessException {
 129         throw new HeadlessException();
 130     }
 131 
 132     public ScrollbarPeer createScrollbar(Scrollbar target)
 133         throws HeadlessException {
 134         throw new HeadlessException();
 135     }
 136 
 137     public ScrollPanePeer createScrollPane(ScrollPane target)
 138         throws HeadlessException {
 139         throw new HeadlessException();
 140     }
 141 
 142     public TextAreaPeer createTextArea(TextArea target)
 143         throws HeadlessException {
 144         throw new HeadlessException();
 145     }
 146 
 147     public FileDialogPeer createFileDialog(FileDialog target)
 148         throws HeadlessException {
 149         throw new HeadlessException();
 150     }
 151 
 152     public MenuBarPeer createMenuBar(MenuBar target)
 153         throws HeadlessException {
 154         throw new HeadlessException();
 155     }
 156 
 157     public MenuPeer createMenu(Menu target)
 158         throws HeadlessException {
 159         throw new HeadlessException();
 160     }
 161 
 162     public PopupMenuPeer createPopupMenu(PopupMenu target)
 163         throws HeadlessException {
 164         throw new HeadlessException();
 165     }
 166 
 167     public MenuItemPeer createMenuItem(MenuItem target)
 168         throws HeadlessException {
 169         throw new HeadlessException();
 170     }
 171 
 172     public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target)
 173         throws HeadlessException {
 174         throw new HeadlessException();
 175     }
 176 
 177     public DragSourceContextPeer createDragSourceContextPeer(
 178         DragGestureEvent dge)
 179         throws InvalidDnDOperationException {
 180         throw new InvalidDnDOperationException("Headless environment");
 181     }
 182 
 183     public RobotPeer createRobot(Robot target, GraphicsDevice screen)
 184         throws AWTException, HeadlessException {
 185         throw new HeadlessException();
 186     }
 187 
 188     public KeyboardFocusManagerPeer getKeyboardFocusManagerPeer() {
 189         // See 6833019.
 190         return kfmPeer;
 191     }
 192 
 193     public TrayIconPeer createTrayIcon(TrayIcon target)
 194       throws HeadlessException {
 195         throw new HeadlessException();
 196     }
 197 
 198     public SystemTrayPeer createSystemTray(SystemTray target)
 199       throws HeadlessException {
 200         throw new HeadlessException();
 201     }
 202 
 203     public boolean isTraySupported() {
 204         return false;
 205     }
 206 
 207     public GlobalCursorManager getGlobalCursorManager()
 208         throws HeadlessException {
 209         throw new HeadlessException();
 210     }
 211 
 212     /*
 213      * Headless toolkit - unsupported.
 214      */

 215     protected void loadSystemColors(int[] systemColors)
 216         throws HeadlessException {
 217         throw new HeadlessException();
 218     }
 219 

 220     public ColorModel getColorModel()
 221         throws HeadlessException {
 222         throw new HeadlessException();
 223     }
 224 

 225     public int getScreenResolution()
 226         throws HeadlessException {
 227         throw new HeadlessException();
 228     }
 229 

 230     public Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight)
 231         throws HeadlessException {
 232         throw new HeadlessException();
 233     }
 234 

 235     public int getMenuShortcutKeyMask()
 236         throws HeadlessException {
 237         throw new HeadlessException();
 238     }
 239 

 240     public boolean getLockingKeyState(int keyCode)
 241         throws UnsupportedOperationException {
 242         throw new HeadlessException();
 243     }
 244 

 245     public void setLockingKeyState(int keyCode, boolean on)
 246         throws UnsupportedOperationException {
 247         throw new HeadlessException();
 248     }
 249 

 250     public Cursor createCustomCursor(Image cursor, Point hotSpot, String name)
 251         throws IndexOutOfBoundsException, HeadlessException {
 252         throw new HeadlessException();
 253     }
 254 

 255     public Dimension getBestCursorSize(int preferredWidth, int preferredHeight)
 256         throws HeadlessException {
 257         throw new HeadlessException();
 258     }
 259 

 260     public int getMaximumCursorColors()
 261         throws HeadlessException {
 262         throw new HeadlessException();
 263     }
 264 

 265     public <T extends DragGestureRecognizer> T
 266         createDragGestureRecognizer(Class<T> abstractRecognizerClass,
 267                                     DragSource ds, Component c,
 268                                     int srcActions, DragGestureListener dgl)
 269     {
 270         return null;
 271     }
 272 
 273     public int getScreenHeight()
 274         throws HeadlessException {
 275         throw new HeadlessException();
 276     }
 277 
 278     public int getScreenWidth()
 279         throws HeadlessException {
 280         throw new HeadlessException();
 281     }
 282 

 283     public Dimension getScreenSize()
 284         throws HeadlessException {
 285         throw new HeadlessException();
 286     }
 287 

 288     public Insets getScreenInsets(GraphicsConfiguration gc)
 289         throws HeadlessException {
 290         throw new HeadlessException();
 291     }
 292 

 293     public void setDynamicLayout(boolean dynamic)
 294         throws HeadlessException {
 295         throw new HeadlessException();
 296     }
 297 

 298     protected boolean isDynamicLayoutSet()
 299         throws HeadlessException {
 300         throw new HeadlessException();
 301     }
 302 

 303     public boolean isDynamicLayoutActive()
 304         throws HeadlessException {
 305         throw new HeadlessException();
 306     }
 307 

 308     public Clipboard getSystemClipboard()
 309         throws HeadlessException {
 310         throw new HeadlessException();
 311     }
 312 
 313     /*
 314      * Printing
 315      */

 316     public PrintJob getPrintJob(Frame frame, String jobtitle,
 317         JobAttributes jobAttributes,
 318         PageAttributes pageAttributes) {
 319         if (frame != null) {
 320             // Should never happen
 321             throw new HeadlessException();
 322         }
 323         throw new NullPointerException("frame must not be null");
 324     }
 325 

 326     public PrintJob getPrintJob(Frame frame, String doctitle, Properties props)
 327     {
 328         if (frame != null) {
 329             // Should never happen
 330             throw new HeadlessException();
 331         }
 332         throw new NullPointerException("frame must not be null");
 333     }
 334 
 335     /*
 336      * Headless toolkit - supported.
 337      */
 338 

 339     public void sync() {
 340         // Do nothing
 341     }
 342 

 343     public void beep() {
 344         // Send alert character
 345         System.out.write(0x07);
 346     }
 347 
 348     /*
 349      * Event Queue
 350      */

 351     public EventQueue getSystemEventQueueImpl() {
 352         return SunToolkit.getSystemEventQueueImplPP();
 353     }
 354 
 355     /*
 356      * Images.
 357      */

 358     public int checkImage(Image img, int w, int h, ImageObserver o) {
 359         return tk.checkImage(img, w, h, o);
 360     }
 361 

 362     public boolean prepareImage(
 363         Image img, int w, int h, ImageObserver o) {
 364         return tk.prepareImage(img, w, h, o);
 365     }
 366 

 367     public Image getImage(String filename) {
 368         return tk.getImage(filename);
 369     }
 370 

 371     public Image getImage(URL url) {
 372         return tk.getImage(url);
 373     }
 374 

 375     public Image createImage(String filename) {
 376         return tk.createImage(filename);
 377     }
 378 

 379     public Image createImage(URL url) {
 380         return tk.createImage(url);
 381     }
 382 

 383     public Image createImage(byte[] data, int offset, int length) {
 384         return tk.createImage(data, offset, length);
 385     }
 386 

 387     public Image createImage(ImageProducer producer) {
 388         return tk.createImage(producer);
 389     }
 390 

 391     public Image createImage(byte[] imagedata) {
 392         return tk.createImage(imagedata);
 393     }
 394 
 395 
 396     /*
 397      * Fonts
 398      */

 399     @SuppressWarnings("deprecation")
 400     public FontPeer getFontPeer(String name, int style) {
 401         if (componentFactory != null) {
 402             return componentFactory.getFontPeer(name, style);
 403         }
 404         return null;
 405     }
 406 
 407     @Override
 408     public DataTransferer getDataTransferer() {
 409         return null;
 410     }
 411 
 412     @SuppressWarnings("deprecation")
 413     public FontMetrics getFontMetrics(Font font) {
 414         return tk.getFontMetrics(font);
 415     }
 416 

 417     @SuppressWarnings("deprecation")
 418     public String[] getFontList() {
 419         return tk.getFontList();
 420     }
 421 
 422     /*
 423      * Desktop properties
 424      */
 425 

 426     public void addPropertyChangeListener(String name,
 427         PropertyChangeListener pcl) {
 428         tk.addPropertyChangeListener(name, pcl);
 429     }
 430 

 431     public void removePropertyChangeListener(String name,
 432         PropertyChangeListener pcl) {
 433         tk.removePropertyChangeListener(name, pcl);
 434     }
 435 
 436     /*
 437      * Modality
 438      */

 439     public boolean isModalityTypeSupported(Dialog.ModalityType modalityType) {
 440         return false;
 441     }
 442 

 443     public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType exclusionType) {
 444         return false;
 445     }
 446 
 447     /*
 448      * Always on top
 449      */

 450     public boolean isAlwaysOnTopSupported() {
 451         return false;
 452     }
 453 
 454     /*
 455      * AWT Event listeners
 456      */
 457 

 458     public void addAWTEventListener(AWTEventListener listener,
 459         long eventMask) {
 460         tk.addAWTEventListener(listener, eventMask);
 461     }
 462 

 463     public void removeAWTEventListener(AWTEventListener listener) {
 464         tk.removeAWTEventListener(listener);
 465     }
 466 

 467     public AWTEventListener[] getAWTEventListeners() {
 468         return tk.getAWTEventListeners();
 469     }
 470 

 471     public AWTEventListener[] getAWTEventListeners(long eventMask) {
 472         return tk.getAWTEventListeners(eventMask);
 473     }
 474 
 475     public boolean isDesktopSupported() {
 476         return false;
 477     }
 478 
 479     public DesktopPeer createDesktopPeer(Desktop target)
 480     throws HeadlessException{
 481         throw new HeadlessException();
 482     }
 483 
 484     public boolean areExtraMouseButtonsEnabled() throws HeadlessException{
 485         throw new HeadlessException();
 486     }
 487 }
   1 /*
   2  * Copyright (c) 2000, 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
  23  * questions.
  24  */
  25 
  26 package sun.awt;
  27 


  28 import java.awt.*;
  29 import java.awt.datatransfer.Clipboard;
  30 import java.awt.dnd.DragGestureListener;
  31 import java.awt.dnd.DragGestureRecognizer;
  32 import java.awt.dnd.DragSource;
  33 import java.awt.event.AWTEventListener;
  34 import java.awt.font.TextAttribute;
  35 import java.awt.im.InputMethodHighlight;
  36 import java.awt.image.ColorModel;
  37 import java.awt.image.ImageObserver;
  38 import java.awt.image.ImageProducer;
  39 import java.awt.peer.FontPeer;
  40 import java.awt.peer.KeyboardFocusManagerPeer;
  41 import java.awt.peer.SystemTrayPeer;
  42 import java.awt.peer.TrayIconPeer;
  43 import java.beans.PropertyChangeListener;
  44 import java.net.URL;
  45 import java.util.Map;
  46 import java.util.Properties;
  47 
  48 public final class HeadlessToolkit extends Toolkit
  49     implements ComponentFactory, KeyboardFocusManagerPeerProvider {
  50 
  51     private static final KeyboardFocusManagerPeer kfmPeer = new KeyboardFocusManagerPeer() {
  52         @Override
  53         public void setCurrentFocusedWindow(Window win) {}
  54         @Override
  55         public Window getCurrentFocusedWindow() { return null; }
  56         @Override
  57         public void setCurrentFocusOwner(Component comp) {}
  58         @Override
  59         public Component getCurrentFocusOwner() { return null; }
  60         @Override
  61         public void clearGlobalFocusOwner(Window activeWindow) {}
  62     };
  63 
  64     private final Toolkit tk;
  65     private ComponentFactory componentFactory;
  66 
  67     public HeadlessToolkit(Toolkit tk) {
  68         this.tk = tk;
  69         if (tk instanceof ComponentFactory) {
  70             componentFactory = (ComponentFactory)tk;
  71         }
  72     }
  73 
  74     public Toolkit getUnderlyingToolkit() {
  75         return tk;
  76     }
  77 
  78     @Override






















































































































  79     public KeyboardFocusManagerPeer getKeyboardFocusManagerPeer() {
  80         // See 6833019.
  81         return kfmPeer;
  82     }
  83 
  84     public TrayIconPeer createTrayIcon(TrayIcon target)
  85       throws HeadlessException {
  86         throw new HeadlessException();
  87     }
  88 
  89     public SystemTrayPeer createSystemTray(SystemTray target)
  90       throws HeadlessException {
  91         throw new HeadlessException();
  92     }
  93 
  94     public boolean isTraySupported() {
  95         return false;
  96     }
  97 
  98     public GlobalCursorManager getGlobalCursorManager()
  99         throws HeadlessException {
 100         throw new HeadlessException();
 101     }
 102 
 103     /*
 104      * Headless toolkit - unsupported.
 105      */
 106     @Override
 107     protected void loadSystemColors(int[] systemColors)
 108         throws HeadlessException {
 109         throw new HeadlessException();
 110     }
 111 
 112     @Override
 113     public ColorModel getColorModel()
 114         throws HeadlessException {
 115         throw new HeadlessException();
 116     }
 117 
 118     @Override
 119     public int getScreenResolution()
 120         throws HeadlessException {
 121         throw new HeadlessException();
 122     }
 123 
 124     @Override
 125     public Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight)
 126         throws HeadlessException {
 127         throw new HeadlessException();
 128     }
 129 
 130     @Override
 131     public int getMenuShortcutKeyMask()
 132         throws HeadlessException {
 133         throw new HeadlessException();
 134     }
 135 
 136     @Override
 137     public boolean getLockingKeyState(int keyCode)
 138         throws UnsupportedOperationException {
 139         throw new HeadlessException();
 140     }
 141 
 142     @Override
 143     public void setLockingKeyState(int keyCode, boolean on)
 144         throws UnsupportedOperationException {
 145         throw new HeadlessException();
 146     }
 147 
 148     @Override
 149     public Cursor createCustomCursor(Image cursor, Point hotSpot, String name)
 150         throws IndexOutOfBoundsException, HeadlessException {
 151         throw new HeadlessException();
 152     }
 153 
 154     @Override
 155     public Dimension getBestCursorSize(int preferredWidth, int preferredHeight)
 156         throws HeadlessException {
 157         throw new HeadlessException();
 158     }
 159 
 160     @Override
 161     public int getMaximumCursorColors()
 162         throws HeadlessException {
 163         throw new HeadlessException();
 164     }
 165 
 166     @Override
 167     public <T extends DragGestureRecognizer> T
 168         createDragGestureRecognizer(Class<T> abstractRecognizerClass,
 169                                     DragSource ds, Component c,
 170                                     int srcActions, DragGestureListener dgl)
 171     {
 172         return null;
 173     }
 174 
 175     public int getScreenHeight()
 176         throws HeadlessException {
 177         throw new HeadlessException();
 178     }
 179 
 180     public int getScreenWidth()
 181         throws HeadlessException {
 182         throw new HeadlessException();
 183     }
 184 
 185     @Override
 186     public Dimension getScreenSize()
 187         throws HeadlessException {
 188         throw new HeadlessException();
 189     }
 190 
 191     @Override
 192     public Insets getScreenInsets(GraphicsConfiguration gc)
 193         throws HeadlessException {
 194         throw new HeadlessException();
 195     }
 196 
 197     @Override
 198     public void setDynamicLayout(boolean dynamic)
 199         throws HeadlessException {
 200         throw new HeadlessException();
 201     }
 202 
 203     @Override
 204     protected boolean isDynamicLayoutSet()
 205         throws HeadlessException {
 206         throw new HeadlessException();
 207     }
 208 
 209     @Override
 210     public boolean isDynamicLayoutActive()
 211         throws HeadlessException {
 212         throw new HeadlessException();
 213     }
 214 
 215     @Override
 216     public Clipboard getSystemClipboard()
 217         throws HeadlessException {
 218         throw new HeadlessException();
 219     }
 220 
 221     /*
 222      * Printing
 223      */
 224     @Override
 225     public PrintJob getPrintJob(Frame frame, String jobtitle,
 226         JobAttributes jobAttributes,
 227         PageAttributes pageAttributes) {
 228         if (frame != null) {
 229             // Should never happen
 230             throw new HeadlessException();
 231         }
 232         throw new NullPointerException("frame must not be null");
 233     }
 234 
 235     @Override
 236     public PrintJob getPrintJob(Frame frame, String doctitle, Properties props)
 237     {
 238         if (frame != null) {
 239             // Should never happen
 240             throw new HeadlessException();
 241         }
 242         throw new NullPointerException("frame must not be null");
 243     }
 244 
 245     /*
 246      * Headless toolkit - supported.
 247      */
 248 
 249     @Override
 250     public void sync() {
 251         // Do nothing
 252     }
 253 
 254     @Override
 255     public void beep() {
 256         // Send alert character
 257         System.out.write(0x07);
 258     }
 259 
 260     /*
 261      * Event Queue
 262      */
 263     @Override
 264     public EventQueue getSystemEventQueueImpl() {
 265         return SunToolkit.getSystemEventQueueImplPP();
 266     }
 267 
 268     /*
 269      * Images.
 270      */
 271     @Override
 272     public int checkImage(Image img, int w, int h, ImageObserver o) {
 273         return tk.checkImage(img, w, h, o);
 274     }
 275 
 276     @Override
 277     public boolean prepareImage(
 278         Image img, int w, int h, ImageObserver o) {
 279         return tk.prepareImage(img, w, h, o);
 280     }
 281 
 282     @Override
 283     public Image getImage(String filename) {
 284         return tk.getImage(filename);
 285     }
 286 
 287     @Override
 288     public Image getImage(URL url) {
 289         return tk.getImage(url);
 290     }
 291 
 292     @Override
 293     public Image createImage(String filename) {
 294         return tk.createImage(filename);
 295     }
 296 
 297     @Override
 298     public Image createImage(URL url) {
 299         return tk.createImage(url);
 300     }
 301 
 302     @Override
 303     public Image createImage(byte[] data, int offset, int length) {
 304         return tk.createImage(data, offset, length);
 305     }
 306 
 307     @Override
 308     public Image createImage(ImageProducer producer) {
 309         return tk.createImage(producer);
 310     }
 311 
 312     @Override
 313     public Image createImage(byte[] imagedata) {
 314         return tk.createImage(imagedata);
 315     }
 316 
 317 
 318     /*
 319      * Fonts
 320      */
 321     @Override
 322     @SuppressWarnings("deprecation")
 323     public FontPeer getFontPeer(String name, int style) {
 324         if (componentFactory != null) {
 325             return componentFactory.getFontPeer(name, style);
 326         }
 327         return null;
 328     }
 329 
 330     @Override




 331     @SuppressWarnings("deprecation")
 332     public FontMetrics getFontMetrics(Font font) {
 333         return tk.getFontMetrics(font);
 334     }
 335 
 336     @Override
 337     @SuppressWarnings("deprecation")
 338     public String[] getFontList() {
 339         return tk.getFontList();
 340     }
 341 
 342     /*
 343      * Desktop properties
 344      */
 345 
 346     @Override
 347     public void addPropertyChangeListener(String name,
 348         PropertyChangeListener pcl) {
 349         tk.addPropertyChangeListener(name, pcl);
 350     }
 351 
 352     @Override
 353     public void removePropertyChangeListener(String name,
 354         PropertyChangeListener pcl) {
 355         tk.removePropertyChangeListener(name, pcl);
 356     }
 357 
 358     /*
 359      * Modality
 360      */
 361     @Override
 362     public boolean isModalityTypeSupported(Dialog.ModalityType modalityType) {
 363         return false;
 364     }
 365 
 366     @Override
 367     public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType exclusionType) {
 368         return false;
 369     }
 370 
 371     /*
 372      * Always on top
 373      */
 374     @Override
 375     public boolean isAlwaysOnTopSupported() {
 376         return false;
 377     }
 378 
 379     /*
 380      * AWT Event listeners
 381      */
 382 
 383     @Override
 384     public void addAWTEventListener(AWTEventListener listener,
 385         long eventMask) {
 386         tk.addAWTEventListener(listener, eventMask);
 387     }
 388 
 389     @Override
 390     public void removeAWTEventListener(AWTEventListener listener) {
 391         tk.removeAWTEventListener(listener);
 392     }
 393 
 394     @Override
 395     public AWTEventListener[] getAWTEventListeners() {
 396         return tk.getAWTEventListeners();
 397     }
 398 
 399     @Override
 400     public AWTEventListener[] getAWTEventListeners(long eventMask) {
 401         return tk.getAWTEventListeners(eventMask);
 402     }
 403 
 404     public boolean isDesktopSupported() {
 405         return false;
 406     }
 407 
 408     @Override




 409     public boolean areExtraMouseButtonsEnabled() throws HeadlessException{
 410         throw new HeadlessException();
 411     }
 412 }