📄 foo
字号:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><html> <head> <title>AWT Enhancements</title> </head><BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#000077" ALINK="#FF0000"><TABLE summary="layout" BORDER="0" WIDTH="100%"><TR><TD WIDTH="60"> <IMG SRC="../../../images/javalogo52x88.gif" ALT="Java" BORDER=0 WIDTH=52 HEIGHT=88></TD><TD><center> <h1>AWT Enhancements in the Java<sup><font size=-2>TM</font></sup> 2SDK, v1.5</h1></center></TD><TD ALIGN=RIGHT VALIGN=TOP> <font size="-1"><a href="../../index.html">Documentation Contents</a></font></TD></TR></TABLE><blockquote><blockquote><a href=#awtMajor>Major Changes</a><br><a href=#window>Window Bugfixes and Enhancements</a><br><a href=#dnd>DnD and Data Transfer Bugfixes and Enhancements</a><br><a href=#layout>Layout Bugfixes</a><br><a href=#misc>Miscellaneous Bugfixes</a><br><a href=#knownBugs>Known Bugs and Issues</a><br></blockquote><hr><a name=awtMajor><h2>Major Changes</h2></a><blockquote><h3><ahref="http://developer.java.sun.com/developer/bugParade/bugs/4615479.html"> <b>4615479</b></a>:XToolkit on Solaris and Linux</h3><blockquote>In this release, AWT has been reimplemented on the Solarisand Linux platforms. It is possible to force the Motif toolkiton Linux or XAWT on Solaris. This is done either by settingthe <code>AWT_TOOLKIT</code> variable or using the<code>-Dawt.toolkit</code> command line parameter.The value for XAWT is <code>sun.awt.X11.XToolkit</code> and thevalue for Motif is <code>sun.awt.motif.MToolkit</code>. For more information, see the <a href=xawt.html>XToolkiton Solaris/Linux</a> note.</blockquote><h3><ahref="http://developer.java.sun.com/developer/bugParade/bugs/4009555.html"> <b>4009555</b></a>: Obtaining the mouse location on the desktop</h3><blockquote>API has been added to obtain the mouse location on the desktop. The new<a href="../../../api/java/awt/PointerInfo.html">PointerInfo</a>class describes the pointer coordinates and theassociated <code>GraphicsDevice</code> object at the moment the<code>PointerInfo</code> instance is created.<code>PointerInfo</code> has the following methods:<ul><li><a href="../../../api/java/awt/PointInfo.html#getDevice()">GraphicsDevice getDevice()</a><li><a href="../../../api/java/awt/PointInfo.html#getLocation()">Point getLocation()</a></ul><p>The new<a href="../../../api/java/awt/MouseInfo.html">MouseInfo</a> classhas information about the current location of the mouse pointer.<code>MouseInfo</code> has two methods:<ul><li><a href="../../../api/java/awt/MouseInfo.html#getPointerInfo()">PointerInfo getPointerInfo()</a><li><a href="../../../api/java/awt/MouseInfo.html#getNumberOfButtons()">int getNumberOfButtons</a></ul><p>Other new methods:<ul><a href="../../../api/java/awt/Component.html#getMousePosition()">java.awt.Component.getMousePosition()</a><br><a href="../../../api/java/awt/Container.html#getMousePosition(boolean)">java.awt.Container.getMousePosition(boolean)</a><br><a href="../../../api/java/awt/Toolkit.html#getMouseInfoPeer()">java.awt.Toolkit.getMouseInfoPeer</a></blockquote></blockquote><a name=window><h2>Window Bugfixes and Enhancements</h2></a><blockquote><h3><ahref="http://developer.java.sun.com/developer/bugParade/bugs/4632143.html"> <b>4632143</b></a>:Window, Frame or Dialog Always on Top</h3><blockquote>New API has been added to ensure that a particular<code>Window</code>, <code>Frame</code> or <code>Dialog</code> isalways on top of the desktop. This is useful when implementingcertain GUI elements, such as tool boxes, notification or informationapplets, and other desktop-enhancing features. The new andmodified API includes:<ul><li><a href="../../../api/java/awt/Window.html#isAlwaysOnTop()">isAlwaysOnTop()</a><li><a href="../../../api/java/awt/Window.html#setAlwaysOnTop(boolean)">setAlwaysOnTop(boolean)</a><li><a href="../../../api/java/awt/Window.html#addPropertyChangeListener(java.beans.PropertyChangeListener)">addPropertyChangeListener(PropertyChangeListener)</a><li><a href="../../../api/java/awt/Window.html#addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)">addPropertyChangeListener(String, PropertyChangeListener)</a><blockquote>The <code>add<i>XXX</i></code> methods have been modified to supportsetting a property change listener on the window's <code>alwaysOnTop</code>state.</blockquote><li><a href="../../../api/java/awt/AWTPermission.html">java.awt.Permission</a><blockquote>The new <code>setWindowAlwaysOnTop</code> permission has been added.</blockquote></ul><p>Depending on the system setup, always-on-top Windows, Frames or Dialogsmay not be supported. They are supported on Microsoft Windows, Linux andSolaris running GNOME2/Metacity, as well as Linux running KDE/kwin.They are not supported on Solaris running CDE/dtwm. It is possible thatalways-on-top windows do not work on Linux or Solaris running sessionand window managers other than those mentioned above.</blockquote><h3><ahref="http://developer.java.sun.com/developer/bugParade/bugs/4102292.html"> <b>4102292</b></a>:New API to Specify Default Window Location by Platform</h3><blockquote>Two new methods and one new property allow the user to specifythe default location for a new <code>Window</code>, appropriate tothe platform. This is especially important for X11. The newapi includes:<ul><li><a href="../../../api/java/awt/Window.html#setLocationByPlatform(boolean)">Window.setLocationByPlatform(boolean)</a><li><a href="../../../api/java/awt/Window.html#isLocationByPlatform()">Window.isLocationByPlatform</a><li>Window.isLocationByPlatform</a> (a property)</ul>Note that the <code>locationByPlatform</code> property must be setto true for the underlying window manager to tile the window accordingto its own logic. Otherwise, AWT won't know whether the window wasput at 0,0 intentionally or was just unspecified and the window willbe placed at the upper-left-hand corner of the screen.</blockquote><h3><ahref="http://developer.java.sun.com/developer/bugParade/bugs/4101435.html"> <b>4101435</b></a>:Window/Dialog/Frame.setLocation doesn't always work as expected</h3><blockquote>The location and size of Windows, Dialogs and Frames, is under the control ofthe desktop's window management system, not the application or the toolkit.The window manager is free to ignore or modify awindow placement request. Therefore, when calling Window.setLocation(x, y),you can't rely on the Window being moved to location (x, y). The samesituation exists for Window.setSize and Window.setBounds. The Window documentation has been clarified to explain this.</blockquote><h3><ahref="http://developer.java.sun.com/developer/bugParade/bugs/4401846.html"> <b>4401846</b></a>:New _JAVA_AWT_WM_STATIC_GRAVITY Environment Variable</h3><blockquote>Certain window managers position AWT windows incorrectly. For example,a window that is requested to be moved to (0,0) will, under somewindow managers, be positioned so that the window's title andleft border are off-screen. This is because there are two schoolsof window managers that disagree on the interpretation of theICCCM specification for the ConfigureRequest requests that X11programs make to position their windows.<p>To address this issue, the <code>_JAVA_AWT_VM_STATIC_GRAVITY</code>environment variable has been added so that a power user can indicatethat his window manager implements the StaticGravity behavior.</blockquote></blockquote><a name=dnd><h2>DnD and Data Transfer Bugfixes and Enhancements</h2></a><blockquote><h3><ahref="http://developer.java.sun.com/developer/bugParade/bugs/4638443.html"> <b>4638443</b></a>: XDnD Support</h3><blockquote>As of this release, the<a href="http://www.newplanetsoftware.com/xdnd/">XDnD Protocol</a>supporthas been implemented as part of the data transfer system. Prior tothis release, only the Motif DnD protocol was supported on X11.</blockquote><h3><ahref="http://developer.java.sun.com/developer/bugParade/bugs/4378091.html"> <b>4378091</b></a>:New DropTarget.getTransferable method</h3><blockquote>The new <a href="../../../api/java/awt/dnd/DropTargetDragEvent.html#getTransferable()">java.awt.dnd.DropTargetDragEvent.getTransferable</a>method enables the drop target to access transfer dataduring a drag operation.<p>This also fixes bug<ahref="http://developer.java.sun.com/developer/bugParade/bugs/4248542.html"> <b>4248542</b></a>:DropTargetListener can't access the transferable in dragOverand dragEnter.</blockquote><h3><ahref="http://developer.java.sun.com/developer/bugParade/bugs/4259272.html"> <b>4259272</b></a>:Notification of Clipboard contents changes is now supported</h3><blockquote>Previously, the Java clipboard API didn't allow an efficient way to trackchanges to the set of DataFlavors available on the clipboard or notifyinterested parties about those changes. API has been added for this purpose:<ul><li><a href="../../../api/java/awt/datatransfer/Clipboard.html#addFlavorListener(java.awt.datatransfer.FlavorListener)"> addFlavorListener(FlavorListener)</a><li><a href="../../../api/java/awt/datatransfer/Clipboard.html#removeFlavorListener(java.awt.datatransfer.FlavorListener)"> removeFlavorListener(FlavorListener)</a><li><a href="../../../api/java/awt/datatransfer/Clipboard.html#getFlavorListeners()"> getFlavorListeners()</a></ul></blockquote><h3><ahref="http://developer.java.sun.com/developer/bugParade/bugs/4287795.html"> <b>4287795</b></a>:New methods for querying information in a Clipboard</h3><blockquote>Three new methods have been added:<ul><li><a href="../../../api/java/awt/datatransfer/Clipboard.html#getAvailableDataFlavors()">DataFlavor[] getAvailableDataFlavors()</a> returns the<code>DataFlavor</code>s currently available on the clipboard.<br><li><a href="../../../api/java/awt/datatransfer/Clipboard.html#isDataFlavorAvailable(java.awt.datatransfer.DataFlavor)">boolean isDataFlavorAvailable(DataFlavor)</a> returns true if
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -