1 /* 2 * Copyright (c) 2008, 2016, 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 jdk.internal.misc.Unsafe; 29 30 import javax.accessibility.AccessibleContext; 31 import java.awt.*; 32 import java.awt.event.FocusEvent.Cause; 33 import java.awt.dnd.DragSourceContext; 34 import java.awt.dnd.DropTargetContext; 35 import java.awt.dnd.peer.DragSourceContextPeer; 36 import java.awt.dnd.peer.DropTargetContextPeer; 37 import java.awt.event.AWTEventListener; 38 import java.awt.event.InputEvent; 39 import java.awt.event.InvocationEvent; 40 import java.awt.event.KeyEvent; 41 import java.awt.geom.Point2D; 42 import java.awt.image.BufferStrategy; 43 import java.awt.peer.ComponentPeer; 44 45 import java.awt.peer.MenuComponentPeer; 46 import java.lang.reflect.InvocationTargetException; 47 import java.security.AccessControlContext; 48 49 import java.io.File; 50 import java.util.ResourceBundle; 51 import java.util.Vector; 52 import javax.accessibility.AccessibleBundle; 53 54 /** 55 * The AWTAccessor utility class. 56 * The main purpose of this class is to enable accessing 57 * private and package-private fields of classes from 58 * different classes/packages. See sun.misc.SharedSecretes 59 * for another example. 60 */ 61 public final class AWTAccessor { 62 63 private static final Unsafe unsafe = Unsafe.getUnsafe(); 64 65 /* 66 * We don't need any objects of this class. 67 * It's rather a collection of static methods 68 * and interfaces. 69 */ 70 private AWTAccessor() { 71 } 72 273 * bypasses disabled Components during the search. 274 */ 275 Component findComponentAt(Container cont, int x, int y, boolean ignoreEnabled); 276 277 /** 278 * Starts LW Modal. 279 */ 280 void startLWModal(Container cont); 281 282 /** 283 * Starts LW Modal. 284 */ 285 void stopLWModal(Container cont); 286 } 287 288 /* 289 * An interface of accessor for java.awt.Window class. 290 */ 291 public interface WindowAccessor { 292 /* 293 * Get opacity level of the given window. 294 */ 295 float getOpacity(Window window); 296 /* 297 * Set opacity level to the given window. 298 */ 299 void setOpacity(Window window, float opacity); 300 /* 301 * Get a shape assigned to the given window. 302 */ 303 Shape getShape(Window window); 304 /* 305 * Set a shape to the given window. 306 */ 307 void setShape(Window window, Shape shape); 308 /* 309 * Set the opaque preoperty to the given window. 310 */ 311 void setOpaque(Window window, boolean isOpaque); 312 /* 313 * Update the image of a non-opaque (translucent) window. 314 */ 315 void updateWindow(Window window); 316 317 /** Get the size of the security warning. 318 */ 319 Dimension getSecurityWarningSize(Window w); 320 321 /** 322 * Set the size of the security warning. 323 */ 324 void setSecurityWarningSize(Window w, int width, int height); 325 326 /** Set the position of the security warning. 327 */ 328 void setSecurityWarningPosition(Window w, Point2D point, 329 float alignmentX, float alignmentY); 330 331 /** Request to recalculate the new position of the security warning for 332 * the given window size/location as reported by the native system. | 1 /* 2 * Copyright (c) 2008, 2017, 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.AWTEvent; 29 import java.awt.AWTException; 30 import java.awt.BufferCapabilities; 31 import java.awt.CheckboxMenuItem; 32 import java.awt.Color; 33 import java.awt.Component; 34 import java.awt.Container; 35 import java.awt.Cursor; 36 import java.awt.DefaultKeyboardFocusManager; 37 import java.awt.Dimension; 38 import java.awt.EventQueue; 39 import java.awt.FileDialog; 40 import java.awt.Font; 41 import java.awt.Frame; 42 import java.awt.GraphicsConfiguration; 43 import java.awt.KeyboardFocusManager; 44 import java.awt.Menu; 45 import java.awt.MenuBar; 46 import java.awt.MenuComponent; 47 import java.awt.MenuContainer; 48 import java.awt.MenuItem; 49 import java.awt.MenuShortcut; 50 import java.awt.Point; 51 import java.awt.PopupMenu; 52 import java.awt.Rectangle; 53 import java.awt.ScrollPaneAdjustable; 54 import java.awt.SystemColor; 55 import java.awt.SystemTray; 56 import java.awt.Toolkit; 57 import java.awt.TrayIcon; 58 import java.awt.Window; 59 import java.awt.dnd.DragSourceContext; 60 import java.awt.dnd.DropTargetContext; 61 import java.awt.dnd.peer.DragSourceContextPeer; 62 import java.awt.dnd.peer.DropTargetContextPeer; 63 import java.awt.event.FocusEvent.Cause; 64 import java.awt.event.InputEvent; 65 import java.awt.event.InvocationEvent; 66 import java.awt.event.KeyEvent; 67 import java.awt.geom.Point2D; 68 import java.awt.image.BufferStrategy; 69 import java.awt.peer.ComponentPeer; 70 import java.awt.peer.MenuComponentPeer; 71 import java.io.File; 72 import java.lang.reflect.InvocationTargetException; 73 import java.security.AccessControlContext; 74 import java.util.ResourceBundle; 75 import java.util.Vector; 76 77 import javax.accessibility.AccessibleBundle; 78 import javax.accessibility.AccessibleContext; 79 80 import jdk.internal.misc.Unsafe; 81 82 /** 83 * The AWTAccessor utility class. 84 * The main purpose of this class is to enable accessing 85 * private and package-private fields of classes from 86 * different classes/packages. See sun.misc.SharedSecretes 87 * for another example. 88 */ 89 public final class AWTAccessor { 90 91 private static final Unsafe unsafe = Unsafe.getUnsafe(); 92 93 /* 94 * We don't need any objects of this class. 95 * It's rather a collection of static methods 96 * and interfaces. 97 */ 98 private AWTAccessor() { 99 } 100 301 * bypasses disabled Components during the search. 302 */ 303 Component findComponentAt(Container cont, int x, int y, boolean ignoreEnabled); 304 305 /** 306 * Starts LW Modal. 307 */ 308 void startLWModal(Container cont); 309 310 /** 311 * Starts LW Modal. 312 */ 313 void stopLWModal(Container cont); 314 } 315 316 /* 317 * An interface of accessor for java.awt.Window class. 318 */ 319 public interface WindowAccessor { 320 /* 321 * Update the image of a non-opaque (translucent) window. 322 */ 323 void updateWindow(Window window); 324 325 /** Get the size of the security warning. 326 */ 327 Dimension getSecurityWarningSize(Window w); 328 329 /** 330 * Set the size of the security warning. 331 */ 332 void setSecurityWarningSize(Window w, int width, int height); 333 334 /** Set the position of the security warning. 335 */ 336 void setSecurityWarningPosition(Window w, Point2D point, 337 float alignmentX, float alignmentY); 338 339 /** Request to recalculate the new position of the security warning for 340 * the given window size/location as reported by the native system. |