3876N/A/*
3876N/A * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
3876N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3876N/A *
3876N/A * This code is free software; you can redistribute it and/or modify it
3876N/A * under the terms of the GNU General Public License version 2 only, as
3876N/A * published by the Free Software Foundation. Oracle designates this
3876N/A * particular file as subject to the "Classpath" exception as provided
3876N/A * by Oracle in the LICENSE file that accompanied this code.
3876N/A *
3876N/A * This code is distributed in the hope that it will be useful, but WITHOUT
3876N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3876N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3876N/A * version 2 for more details (a copy is included in the LICENSE file that
3876N/A * accompanied this code).
3876N/A *
3876N/A * You should have received a copy of the GNU General Public License version
3876N/A * 2 along with this work; if not, write to the Free Software Foundation,
3876N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3876N/A *
3876N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3876N/A * or visit www.oracle.com if you need additional information or have any
3876N/A * questions.
3876N/A */
3876N/A
3876N/Apackage sun.awt;
3876N/A
3876N/Aimport java.awt.*;
3876N/Aimport java.awt.dnd.*;
3876N/Aimport java.awt.dnd.peer.DragSourceContextPeer;
3876N/Aimport java.awt.im.InputMethodHighlight;
3876N/Aimport java.awt.im.spi.InputMethodDescriptor;
3876N/Aimport java.awt.image.*;
3876N/Aimport java.awt.datatransfer.Clipboard;
3876N/Aimport java.awt.peer.*;
3876N/Aimport java.util.Map;
3876N/Aimport java.util.Properties;
3876N/A
3876N/A/*
3876N/A * HToolkit is a platform independent Toolkit used
3876N/A * with the HeadlessToolkit. It is primarily used
3876N/A * in embedded JRE's that do not have sun/awt/X11 classes.
3876N/A */
3876N/Apublic class HToolkit extends SunToolkit
3876N/A implements ComponentFactory {
3876N/A
5336N/A private static final KeyboardFocusManagerPeer kfmPeer = new KeyboardFocusManagerPeer() {
5336N/A public void setCurrentFocusedWindow(Window win) {}
5336N/A public Window getCurrentFocusedWindow() { return null; }
5336N/A public void setCurrentFocusOwner(Component comp) {}
5336N/A public Component getCurrentFocusOwner() { return null; }
5336N/A public void clearGlobalFocusOwner(Window activeWindow) {}
5336N/A };
5336N/A
3876N/A public HToolkit() {
3876N/A }
3876N/A
3876N/A /*
3876N/A * Component peer objects - unsupported.
3876N/A */
3876N/A
3876N/A public WindowPeer createWindow(Window target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public FramePeer createFrame(Frame target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public DialogPeer createDialog(Dialog target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public ButtonPeer createButton(Button target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public TextFieldPeer createTextField(TextField target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public ChoicePeer createChoice(Choice target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public LabelPeer createLabel(Label target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public ListPeer createList(List target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public CheckboxPeer createCheckbox(Checkbox target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public ScrollbarPeer createScrollbar(Scrollbar target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public ScrollPanePeer createScrollPane(ScrollPane target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public TextAreaPeer createTextArea(TextArea target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public FileDialogPeer createFileDialog(FileDialog target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public MenuBarPeer createMenuBar(MenuBar target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public MenuPeer createMenu(Menu target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public PopupMenuPeer createPopupMenu(PopupMenu target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public MenuItemPeer createMenuItem(MenuItem target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public DragSourceContextPeer createDragSourceContextPeer(
3876N/A DragGestureEvent dge)
3876N/A throws InvalidDnDOperationException {
3876N/A throw new InvalidDnDOperationException("Headless environment");
3876N/A }
3876N/A
3876N/A public RobotPeer createRobot(Robot target, GraphicsDevice screen)
3876N/A throws AWTException, HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
5336N/A public KeyboardFocusManagerPeer getKeyboardFocusManagerPeer() {
3876N/A // See 6833019.
5336N/A return kfmPeer;
3876N/A }
3876N/A
3876N/A public TrayIconPeer createTrayIcon(TrayIcon target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public SystemTrayPeer createSystemTray(SystemTray target)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public boolean isTraySupported() {
3876N/A return false;
3876N/A }
3876N/A
3876N/A public GlobalCursorManager getGlobalCursorManager()
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A /*
3876N/A * Headless toolkit - unsupported.
3876N/A */
3876N/A protected void loadSystemColors(int[] systemColors)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public ColorModel getColorModel()
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public int getScreenResolution()
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public Map mapInputMethodHighlight(InputMethodHighlight highlight)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public int getMenuShortcutKeyMask()
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public boolean getLockingKeyState(int keyCode)
3876N/A throws UnsupportedOperationException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public void setLockingKeyState(int keyCode, boolean on)
3876N/A throws UnsupportedOperationException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public Cursor createCustomCursor(Image cursor, Point hotSpot, String name)
3876N/A throws IndexOutOfBoundsException, HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public Dimension getBestCursorSize(int preferredWidth, int preferredHeight)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public int getMaximumCursorColors()
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public <T extends DragGestureRecognizer> T
3876N/A createDragGestureRecognizer(Class<T> abstractRecognizerClass,
3876N/A DragSource ds, Component c,
3876N/A int srcActions, DragGestureListener dgl)
3876N/A {
3876N/A return null;
3876N/A }
3876N/A
3876N/A public int getScreenHeight()
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public int getScreenWidth()
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public Dimension getScreenSize()
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public Insets getScreenInsets(GraphicsConfiguration gc)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public void setDynamicLayout(boolean dynamic)
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A protected boolean isDynamicLayoutSet()
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public boolean isDynamicLayoutActive()
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public Clipboard getSystemClipboard()
3876N/A throws HeadlessException {
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A /*
3876N/A * Printing
3876N/A */
3876N/A public PrintJob getPrintJob(Frame frame, String jobtitle,
3876N/A JobAttributes jobAttributes,
3876N/A PageAttributes pageAttributes) {
3876N/A if (frame != null) {
3876N/A // Should never happen
3876N/A throw new HeadlessException();
3876N/A }
3876N/A throw new IllegalArgumentException(
3876N/A "PrintJob not supported in a headless environment");
3876N/A }
3876N/A
3876N/A public PrintJob getPrintJob(Frame frame, String doctitle, Properties props)
3876N/A {
3876N/A if (frame != null) {
3876N/A // Should never happen
3876N/A throw new HeadlessException();
3876N/A }
3876N/A throw new IllegalArgumentException(
3876N/A "PrintJob not supported in a headless environment");
3876N/A }
3876N/A
3876N/A /*
3876N/A * Headless toolkit - supported.
3876N/A */
3876N/A
3876N/A public void sync() {
3876N/A // Do nothing
3876N/A }
3876N/A
3876N/A protected boolean syncNativeQueue(final long timeout) {
3876N/A return false;
3876N/A }
3876N/A
3876N/A public void beep() {
3876N/A // Send alert character
3876N/A System.out.write(0x07);
3876N/A }
3876N/A
3876N/A
3876N/A /*
3876N/A * Fonts
3876N/A */
3876N/A public FontPeer getFontPeer(String name, int style) {
3876N/A return (FontPeer)null;
3876N/A }
3876N/A
3876N/A /*
3876N/A * Modality
3876N/A */
3876N/A public boolean isModalityTypeSupported(Dialog.ModalityType modalityType) {
3876N/A return false;
3876N/A }
3876N/A
3876N/A public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType exclusionType) {
3876N/A return false;
3876N/A }
3876N/A
3876N/A public boolean isDesktopSupported() {
3876N/A return false;
3876N/A }
3876N/A
3876N/A public DesktopPeer createDesktopPeer(Desktop target)
3876N/A throws HeadlessException{
3876N/A throw new HeadlessException();
3876N/A }
3876N/A
3876N/A public boolean isWindowOpacityControlSupported() {
3876N/A return false;
3876N/A }
3876N/A
3876N/A public boolean isWindowShapingSupported() {
3876N/A return false;
3876N/A }
3876N/A
3876N/A public boolean isWindowTranslucencySupported() {
3876N/A return false;
3876N/A }
3876N/A
3876N/A public void grab(Window w) { }
3876N/A
3876N/A public void ungrab(Window w) { }
3876N/A
3876N/A protected boolean syncNativeQueue() { return false; }
3876N/A
3876N/A public InputMethodDescriptor getInputMethodAdapterDescriptor()
3876N/A throws AWTException
3876N/A {
3876N/A return (InputMethodDescriptor)null;
3876N/A }
3876N/A}