Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/awt/HToolkit.java
38827 views
/*1* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package sun.awt;2627import sun.awt.datatransfer.DataTransferer;2829import java.awt.*;30import java.awt.dnd.*;31import java.awt.dnd.peer.DragSourceContextPeer;32import java.awt.im.InputMethodHighlight;33import java.awt.im.spi.InputMethodDescriptor;34import java.awt.image.*;35import java.awt.datatransfer.Clipboard;36import java.awt.peer.*;37import java.util.Map;38import java.util.Properties;3940/*41* HToolkit is a platform independent Toolkit used42* with the HeadlessToolkit. It is primarily used43* in embedded JRE's that do not have sun/awt/X11 classes.44*/45public class HToolkit extends SunToolkit46implements ComponentFactory {4748private static final KeyboardFocusManagerPeer kfmPeer = new KeyboardFocusManagerPeer() {49public void setCurrentFocusedWindow(Window win) {}50public Window getCurrentFocusedWindow() { return null; }51public void setCurrentFocusOwner(Component comp) {}52public Component getCurrentFocusOwner() { return null; }53public void clearGlobalFocusOwner(Window activeWindow) {}54};5556public HToolkit() {57}5859/*60* Component peer objects - unsupported.61*/6263public WindowPeer createWindow(Window target)64throws HeadlessException {65throw new HeadlessException();66}6768public FramePeer createLightweightFrame(LightweightFrame target)69throws HeadlessException {70throw new HeadlessException();71}7273public FramePeer createFrame(Frame target)74throws HeadlessException {75throw new HeadlessException();76}7778public DialogPeer createDialog(Dialog target)79throws HeadlessException {80throw new HeadlessException();81}8283public ButtonPeer createButton(Button target)84throws HeadlessException {85throw new HeadlessException();86}8788public TextFieldPeer createTextField(TextField target)89throws HeadlessException {90throw new HeadlessException();91}9293public ChoicePeer createChoice(Choice target)94throws HeadlessException {95throw new HeadlessException();96}9798public LabelPeer createLabel(Label target)99throws HeadlessException {100throw new HeadlessException();101}102103public ListPeer createList(List target)104throws HeadlessException {105throw new HeadlessException();106}107108public CheckboxPeer createCheckbox(Checkbox target)109throws HeadlessException {110throw new HeadlessException();111}112113public ScrollbarPeer createScrollbar(Scrollbar target)114throws HeadlessException {115throw new HeadlessException();116}117118public ScrollPanePeer createScrollPane(ScrollPane target)119throws HeadlessException {120throw new HeadlessException();121}122123public TextAreaPeer createTextArea(TextArea target)124throws HeadlessException {125throw new HeadlessException();126}127128public FileDialogPeer createFileDialog(FileDialog target)129throws HeadlessException {130throw new HeadlessException();131}132133public MenuBarPeer createMenuBar(MenuBar target)134throws HeadlessException {135throw new HeadlessException();136}137138public MenuPeer createMenu(Menu target)139throws HeadlessException {140throw new HeadlessException();141}142143public PopupMenuPeer createPopupMenu(PopupMenu target)144throws HeadlessException {145throw new HeadlessException();146}147148public MenuItemPeer createMenuItem(MenuItem target)149throws HeadlessException {150throw new HeadlessException();151}152153public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target)154throws HeadlessException {155throw new HeadlessException();156}157158public DragSourceContextPeer createDragSourceContextPeer(159DragGestureEvent dge)160throws InvalidDnDOperationException {161throw new InvalidDnDOperationException("Headless environment");162}163164public RobotPeer createRobot(Robot target, GraphicsDevice screen)165throws AWTException, HeadlessException {166throw new HeadlessException();167}168169public KeyboardFocusManagerPeer getKeyboardFocusManagerPeer() {170// See 6833019.171return kfmPeer;172}173174public TrayIconPeer createTrayIcon(TrayIcon target)175throws HeadlessException {176throw new HeadlessException();177}178179public SystemTrayPeer createSystemTray(SystemTray target)180throws HeadlessException {181throw new HeadlessException();182}183184public boolean isTraySupported() {185return false;186}187188@Override189public DataTransferer getDataTransferer() {190return null;191}192193public GlobalCursorManager getGlobalCursorManager()194throws HeadlessException {195throw new HeadlessException();196}197198/*199* Headless toolkit - unsupported.200*/201protected void loadSystemColors(int[] systemColors)202throws HeadlessException {203throw new HeadlessException();204}205206public ColorModel getColorModel()207throws HeadlessException {208throw new HeadlessException();209}210211public int getScreenResolution()212throws HeadlessException {213throw new HeadlessException();214}215216public Map mapInputMethodHighlight(InputMethodHighlight highlight)217throws HeadlessException {218throw new HeadlessException();219}220221public int getMenuShortcutKeyMask()222throws HeadlessException {223throw new HeadlessException();224}225226public boolean getLockingKeyState(int keyCode)227throws UnsupportedOperationException {228throw new HeadlessException();229}230231public void setLockingKeyState(int keyCode, boolean on)232throws UnsupportedOperationException {233throw new HeadlessException();234}235236public Cursor createCustomCursor(Image cursor, Point hotSpot, String name)237throws IndexOutOfBoundsException, HeadlessException {238throw new HeadlessException();239}240241public Dimension getBestCursorSize(int preferredWidth, int preferredHeight)242throws HeadlessException {243throw new HeadlessException();244}245246public int getMaximumCursorColors()247throws HeadlessException {248throw new HeadlessException();249}250251public <T extends DragGestureRecognizer> T252createDragGestureRecognizer(Class<T> abstractRecognizerClass,253DragSource ds, Component c,254int srcActions, DragGestureListener dgl)255{256return null;257}258259public int getScreenHeight()260throws HeadlessException {261throw new HeadlessException();262}263264public int getScreenWidth()265throws HeadlessException {266throw new HeadlessException();267}268269public Dimension getScreenSize()270throws HeadlessException {271throw new HeadlessException();272}273274public Insets getScreenInsets(GraphicsConfiguration gc)275throws HeadlessException {276throw new HeadlessException();277}278279public void setDynamicLayout(boolean dynamic)280throws HeadlessException {281throw new HeadlessException();282}283284protected boolean isDynamicLayoutSet()285throws HeadlessException {286throw new HeadlessException();287}288289public boolean isDynamicLayoutActive()290throws HeadlessException {291throw new HeadlessException();292}293294public Clipboard getSystemClipboard()295throws HeadlessException {296throw new HeadlessException();297}298299/*300* Printing301*/302public PrintJob getPrintJob(Frame frame, String jobtitle,303JobAttributes jobAttributes,304PageAttributes pageAttributes) {305if (frame != null) {306// Should never happen307throw new HeadlessException();308}309throw new IllegalArgumentException(310"PrintJob not supported in a headless environment");311}312313public PrintJob getPrintJob(Frame frame, String doctitle, Properties props)314{315if (frame != null) {316// Should never happen317throw new HeadlessException();318}319throw new IllegalArgumentException(320"PrintJob not supported in a headless environment");321}322323/*324* Headless toolkit - supported.325*/326327public void sync() {328// Do nothing329}330331protected boolean syncNativeQueue(final long timeout) {332return false;333}334335public void beep() {336// Send alert character337System.out.write(0x07);338}339340341/*342* Fonts343*/344public FontPeer getFontPeer(String name, int style) {345return (FontPeer)null;346}347348/*349* Modality350*/351public boolean isModalityTypeSupported(Dialog.ModalityType modalityType) {352return false;353}354355public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType exclusionType) {356return false;357}358359public boolean isDesktopSupported() {360return false;361}362363public DesktopPeer createDesktopPeer(Desktop target)364throws HeadlessException{365throw new HeadlessException();366}367368public boolean isWindowOpacityControlSupported() {369return false;370}371372public boolean isWindowShapingSupported() {373return false;374}375376public boolean isWindowTranslucencySupported() {377return false;378}379380public void grab(Window w) { }381382public void ungrab(Window w) { }383384protected boolean syncNativeQueue() { return false; }385386public InputMethodDescriptor getInputMethodAdapterDescriptor()387throws AWTException388{389return (InputMethodDescriptor)null;390}391}392393394