提交 b3c1eef2 编写于 作者: 檀越@新空间's avatar 檀越@新空间 🐭

fix:添加重写

上级 8f686982
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/
此差异已折叠。
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AliControlFlowStatementWithoutBraces" enabled="false" level="BLOCKER" enabled_by_default="false" />
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
<option name="TOP_LEVEL_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="INNER_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="METHOD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
</value>
</option>
<option name="FIELD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="IGNORE_DEPRECATED" value="false" />
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
<option name="myAdditionalJavadocTags" value="date" />
</inspection_tool>
<inspection_tool class="WrongPackageStatement" enabled="false" level="ERROR" enabled_by_default="false" />
</profile>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_16" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/classes1.iml" filepath="$PROJECT_DIR$/classes1.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
<!--
Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<body bgcolor="white">
Provides the classes necessary to create an applet and the classes an applet
uses to communicate with its applet context.
<p>
The applet framework involves two
entities: the <i>applet</i> and the <i>applet context</i>. An applet is an
embeddable window (see the Panel class) with a few extra methods that the applet
context can use to initialize, start, and stop the applet.
<p>
The applet context is an application that is responsible for loading and running
applets. For example, the applet context could be a Web browser or an applet
development environment.
<p>
<!--
<h2>Package Specification</h2>
##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
<ul>
<li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
</ul>
<h2>Related Documentation</h2>
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
</ul>
-->
@since JDK1.0
</body>
</html>
<!--
Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head><title></title></head>
<body bgcolor="white">
Provides classes for color spaces. It contains an
implementation of a color space based on the International Color
Consortium (ICC) Profile Format Specification, Version 3.4, August 15,
1997. It also contains color profiles based on the ICC Profile Format
Specification.
<!--
<h2>Package Specification</h2>
##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
<ul>
<li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
</ul>
<h2>Related Documentation</h2>
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
</ul>
-->
@since 1.2
</body>
</html>
<!--
Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head><title></title></head>
<body bgcolor="white">
Provides interfaces and classes for transferring data
between and within applications. It defines the notion of a
"transferable" object, which is an object capable of being
transferred between or within applications. An object identifies
itself as being transferable by implementing the Transferable
interface.
<p>
It also provides a clipboard mechanism, which is an object that
temporarily holds a transferable object that can be transferred
between or within an application. The clipboard is typically used
for copy and paste operations. Although it is possible to create
a clipboard to use within an application, most applications will
use the system clipboard to ensure the data can be transferred
across applications running on the platform.
<!--
<h2>Package Specification</h2>
##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
<ul>
<li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
</ul>
<h2>Related Documentation</h2>
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
</ul>
-->
@since JDK1.1
</body>
</html>
<!--
Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head><title></title></head>
<body bgcolor="white">
Drag and Drop is a direct manipulation gesture found in many Graphical
User Interface systems that provides a mechanism to transfer
information between two entities logically associated with presentation
elements in the GUI. Normally driven by a physical gesture of a
human user using an appropriate input device, Drag and Drop provides both
a mechanism to enable continuous feedback regarding the
possible outcome of any subsequent data transfer to the user during
navigation over the presentation elements in the GUI, and the facilities
to provide for any subsequent data negotiation and transfer.
<P>
This package defines the classes and interfaces necessary to perform Drag
and Drop operations in Java. It
defines classes for the drag-source and the drop-target, as well as
events for transferring the data being dragged. This package also provides
a means for giving visual feedback to the user throughout the
duration of the Drag and Drop operation.
<P>
A typical Drag and Drop operation can be decomposed into the following
states (not entirely sequentially):
<UL>
<LI>A <code>DragSource</code> comes into existence,
associated with some presentation
element (<code>Component</code>) in the GUI, to initiate a Drag and Drop of
some potentially <code>Transferable</code> data.
<br><br>
<LI>1 or more <code>DropTarget</code>(s) come into/go out of
existence, associated
with presentation elements in the GUI (Components), potentially
capable of consuming <code>Transferable</code> data types.
<br><br>
<LI> A <code>DragGestureRecognizer</code> is
obtained from the <code>DragSource</code> and is
associated with a <code>Component</code> in order
to track and identify any Drag
initiating gesture by the user over the <code>Component</code>.
<br><br>
<LI> A user makes a Drag gesture over the <code>Component</code>,
which the registered
<code>DragGestureRecognizer</code> detects, and notifies its
<code>DragGestureListener</code> of.
<P>
Note: Although this API consistently refers to the stimulus for a
drag and drop operation being a physical gesture by a human user, this
does not preclude a programmatically driven DnD operation given the
appropriate implementation of a <code>DragSource</code>. This package
contains the abstract class <code>MouseDragGestureRecognizer</code> for
recognizing mouse device gestures. Other abstract subclasses may be
provided by the platform to support other input devices or
particular <code>Component</code> class semantics.
<br><br>
<LI> The <code>DragGestureListener</code> causes the
<code>DragSource</code> to initiate the Drag
and Drop operation on behalf of the user, perhaps animating the
GUI Cursor and/or rendering an <code>Image</code> of the item(s) that are the
subject of the operation.
<br><br>
<LI> As the user gestures navigate over <code>Component</code>(s)
in the GUI with
associated <code>DropTarget</code>(s), the <code>DragSource</code>
receives notifications in order
to provide "Drag Over" feedback effects, and the <code>DropTarget</code>(s)
receive notifications in order to provide "Drag Under" feedback effects
based upon the operation(s) supported and the data type(s) involved.
</UL>
<P>
The gesture itself moves a logical cursor across the GUI hierarchy,
intersecting the geometry of GUI Component(s), possibly resulting in
the logical "Drag" cursor entering, crossing, and subsequently
leaving <code>Component</code>(s) and associated <code>DropTarget</code>(s).
<P>
The <code>DragSource</code> object manifests "Drag Over" feedback to the user, in the typical case by animating the GUI <code>Cursor</code> associated with the
logical cursor.
<P>
<code>DropTarget</code> objects manifest "Drag Under" feedback to the user, in
the typical case, by rendering animations into their associated GUI
<code>Component</code>(s) under the GUI Cursor.
<P>
The determination of the feedback effects, and the ultimate success
or failure of the data transfer, should one occur, is parameterized
as follows:
<UL>
<LI> By the transfer "operation" selected by the user, and supported by
both the <code>DragSource</code> and <code>DropTarget</code>: Copy, Move or Reference(link).
<br><br>
<LI> By the intersection of the set of data types provided by the
<code>DragSource</code> and the set of data types comprehensible by the
<code>DropTarget</code>.
<br><br>
<LI>When the user terminates the drag operation, normally resulting in a
successful Drop, both the <code>DragSource</code> and <code>DropTarget</code>
receive
notifications that include, and result in the type negotiation and
transfer of, the information associated with the <code>DragSource</code> via a
<code>Transferable</code> object.
</UL>
<!--
<h2>Package Specification</h2>
##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
<ul>
<li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
</ul>
<h2>Related Documentation</h2>
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
</ul>
-->
@since 1.2
</body>
</html>
<!--
Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<body bgcolor="white">
Provides for interfacing with the underlying window system
in order to access its platform-dependent drag-and-drop facilities.
This package is only used by AWT toolkit developers.
<h2>Package Specification</h2>
##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
<ul>
<li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
</ul>
<h2>Related Documentation</h2>
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
</ul>
</body>
</html>
<!--
Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body bgcolor=white>
<h1 align=center>AWT Threading Issues</h1>
<a name="ListenersThreads"></a>
<h2>Listeners and threads</h2>
Unless otherwise noted all AWT listeners are notified on the event
dispatch thread. It is safe to remove/add listeners from any thread
during dispatching, but the changes only effect subsequent notification.
<br>For example, if a key listeners is added from another key listener, the
newly added listener is only notified on subsequent key events.
<a name="Autoshutdown"></a>
<h2>Auto-shutdown</h2>
According to
<cite>The Java&trade; Virtual Machine Specification</cite>,
sections 2.17.9 and 2.19,
the Java virtual machine (JVM) initially starts up with a single non-daemon
thread, which typically calls the <code>main</code> method of some class.
The virtual machine terminates all its activity and exits when
one of two things happens:
<ul>
<li> All the threads that are not daemon threads terminate.
<li> Some thread invokes the <code>exit</code> method of class
<code>Runtime</code> or class <code>System</code>, and the exit
operation is permitted by the security manager.
</ul>
<p>
This implies that if an application doesn't start any threads itself,
the JVM will exit as soon as <code>main</code> terminates.
This is not the case, however, for a simple application
that creates and displays a <code>java.awt.Frame</code>:
<pre>
public static void main(String[] args) {
Frame frame = new Frame();
frame.setVisible(true);
}
</pre>
The reason is that AWT encapsulates asynchronous event dispatch
machinery to process events AWT or Swing components can fire. The
exact behavior of this machinery is implementation-dependent. In
particular, it can start non-daemon helper threads for its internal
purposes. In fact, these are the threads that prevent the example
above from exiting. The only restrictions imposed on the behavior of
this machinery are as follows:
<ul>
<li> <a href="../EventQueue.html#isDispatchThread()"><code>EventQueue.isDispatchThread</code></a>
returns <code>true</code> if and only if the calling thread is the
event dispatch thread started by the machinery;
<li> <code>AWTEvents</code> which were actually enqueued to a
particular <code>EventQueue</code> (note that events being
posted to the <code>EventQueue</code> can be coalesced) are
dispatched:
<ul>
<li> Sequentially.
<dl><dd> That is, it is not permitted that several events from
this queue are dispatched simultaneously. </dd></dl>
<li> In the same order as they are enqueued.
<dl><dd> That is, if <code>AWTEvent</code>&nbsp;A is enqueued
to the <code>EventQueue</code> before
<code>AWTEvent</code>&nbsp;B then event B will not be
dispatched before event A.</dd></dl>
</ul>
<li> There is at least one alive non-daemon thread while there is at
least one displayable AWT or Swing component within the
application (see
<a href="../Component.html#isDisplayable()"><code>Component.isDisplayable</code></a>).
</ul>
The implications of the third restriction are as follows:
<ul>
<li> The JVM will exit if some thread invokes the <code>exit</code>
method of class <code>Runtime</code> or class <code>System</code>
regardless of the presence of displayable components;
<li> Even if the application terminates all non-daemon threads it
started, the JVM will not exit while there is at least one
displayable component.
</ul>
It depends on the implementation if and when the non-daemon helper
threads are terminated once all components are made undisplayable.
The implementation-specific details are given below.
<h3>
Implementation-dependent behavior.
</h3>
Prior to 1.4, the helper threads were never terminated.
<p>
Starting with 1.4, the behavior has changed as a result of the fix for
<a href="http://bugs.sun.com/view_bug.do?bug_id=4030718">
4030718</a>. With the current implementation, AWT terminates all its
helper threads allowing the application to exit cleanly when the
following three conditions are true:
<ul>
<li> There are no displayable AWT or Swing components.
<li> There are no native events in the native event queue.
<li> There are no AWT events in java EventQueues.
</ul>
Therefore, a stand-alone AWT application that wishes to exit
cleanly without calling <code>System.exit</code> must:
<ul>
<li> Make sure that all AWT or Swing components are made
undisplayable when the application finishes. This can be done
by calling
<a href="../Window.html#dispose()"><code>Window.dispose</code></a>
on all top-level <code>Windows</code>. See
<a href="../Frame.html#getFrames()"><code>Frame.getFrames</code></a>.
<li> Make sure that no method of AWT event listeners registered by
the application with any AWT or Swing component can run into an
infinite loop or hang indefinitely. For example, an AWT listener
method triggered by some AWT event can post a new AWT event of
the same type to the <code>EventQueue</code>.
The argument is that methods
of AWT event listeners are typically executed on helper
threads.
</ul>
Note, that while an application following these recommendations will
exit cleanly under normal conditions, it is not guaranteed that it
will exit cleanly in all cases. Two examples:
<ul>
<li> Other packages can create displayable components for internal
needs and never make them undisplayable. See
<a href="http://bugs.sun.com/view_bug.do?bug_id=4515058">
4515058</a>,
<a href="http://bugs.sun.com/view_bug.do?bug_id=4671025">
4671025</a>, and
<a href="http://bugs.sun.com/view_bug.do?bug_id=4465537">
4465537</a>.
<li> Both Microsoft Windows and X11 allow an application to send native
events to windows that belong to another application. With this
feature it is possible to write a malicious program that will
continuously send events to all available windows preventing
any AWT application from exiting cleanly.
</ul>
On the other hand, if you require the JVM to continue running even after
the application has made all components undisplayable you should start a
non-daemon thread that blocks forever.
<pre>
<...>
Runnable r = new Runnable() {
public void run() {
Object o = new Object();
try {
synchronized (o) {
o.wait();
}
} catch (InterruptedException ie) {
}
}
};
Thread t = new Thread(r);
t.setDaemon(false);
t.start();
<...>
</pre>
<cite>The Java&trade; Virtual Machine Specification</cite>
guarantees
that the JVM doesn't exit until this thread terminates.
</body>
</html>
<!--
Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body bgcolor=white>
<h1 align=center>AWT Desktop Properties</h1>
The following refers to standard AWT desktop properties that
may be obtained via the
<a href="../Toolkit.html#getDesktopProperty(java.lang.String)">
<code>Toolkit.getDesktopProperty</code></a> method.
<p>
Each desktop property is named by a unique string, which
is the "name" of that property.
<p>
Desktop properties supported by the AWT but not documented
elsewhere - typically because there is no suitable
method or class - are documented here.
<p>
Desktop properties documented elsewhere are those which are
tightly coupled with a method or class which documents them.
<p>
Since desktop properties abstract an underlying platform
setting, they may not be available in environments that do
not support them. In the event that a desktop property is
unavailable for any reason, the implementation will return
<code>null</code>.
<p>
The following table summarizes the desktop properties documented
here, and their value types.
<br><br>
<table align="center" border="0" cellspacing="0" cellpadding="2"
summary="Standard AWT Desktop Properties">
<tr bgcolor="#ccccff">
<th valign="TOP" align="LEFT">Property Name</th>
<th valign="TOP" align="LEFT">Value Type</th>
<th valign="TOP" align="LEFT">Summary Description</th>
</tr>
<tr>
<td valign="TOP"><A href="#awt.font.desktophints">awt.font.desktophints</A></td>
<td valign="TOP"><a href="../../util/Map.html">java.util.Map</a></td>
<td valign="TOP">Font smoothing (text antialiasing) settings.</td>
</tr>
<tr>
<td valign="TOP"><A href="#sun.awt.enableExtraMouseButtons">sun.awt.enableExtraMouseButtons</A></td>
<td valign="TOP"><a href="../../lang/Boolean.html">java.lang.Boolean</a></td>
<td valign="TOP">Controls if mouse events from extra buttons are to be generated or not</td>
</tr>
</table>
<h2>Desktop Font Rendering Hints</h2>
<b>Desktop Property: <A name="awt.font.desktophints">"awt.font.desktophints"</A></b>
<p>
Modern desktops support various forms of text antialiasing (font smoothing).
<p>
These are applied by platform-specific heavyweight components.
However an application may want to render text using the same text
antialiasing on a drawing surface or lightweight (non-platform) component using
<a href="../Graphics2D.html"> <code>Graphics2D</code></a> methods.
This is particularly important when creating
<a href="../../../javax/swing/JComponent.html"> Swing components</a> which
are required to appear consistent with native desktop components or other
Swing components.
<h3>Basic Usage</h3>
The standard desktop property named
<b>"awt.font.desktophints"</b>
can be used to obtain the rendering hints that best match the desktop settings.
The return value is a
<a href="../../util/Map.html"> Map</a> of
<a href="../RenderingHints.html"> <code>RenderingHints</code></a> which
can be directly applied to a <code>Graphics2D</code>.
<p>
It is a <code>Map</code> as more than one hint may be needed.
If non-null this can be directly applied to the <code>Graphics2D</code>.
<pre><code>
Toolkit tk = Toolkit.getDefaultToolkit();
Map map = (Map)(tk.getDesktopProperty("awt.font.desktophints"));
if (map != null) {
graphics2D.addRenderingHints(map);
}
</code></pre>
<h3>Advanced Usage Tips</h3>
<h4>Listening for changes</h4>
<p>
An application can listen for changes in the property
using a <a href="../../beans/PropertyChangeListener.html">
<code>PropertyChangeListener</code></a> :
<pre><code>
tk.addPropertyChangeListener("awt.font.desktophints", pcl);
</code></pre>
Listening for changes is recommended as users can, on rare occasions,
reconfigure a desktop environment whilst applications are running
in a way that may affect the selection of these hints, and furthermore
many desktop environments support dynamic reconfiguration of these
running applications to conform to the new settings.
<p>
There is no direct way to discover if dynamic reconfiguration
is expected of running applications but the default assumption
should be that it is expected, since most modern desktop environments
do provide this capability.
<h4>Text Measurement</h4>
<p>
Text always needs to be measured using the same
<a href="../font/FontRenderContext.html"> <code>FontRenderContext</code></a>
as used for rendering. The text anti-aliasing hint is a component of
the <code>FontRenderContext</code>.
A <a href="../FontMetrics.html"> <code>FontMetrics</code></a>
obtained from the <code>Graphics</code> object on which the hint
has been set will measure text appropriately.
This is not a unique requirement for clients that specify this hint
directly, since the value of the <code>FontRenderContext</code> should
never be assumed, so is discussed here principally as a reminder.
<h4>Saving and restoring Graphics State</h4>
<p>
Sometimes an application may need to apply these hints on a shared
Graphics only temporarily, restoring the previous values after they
have been applied to text rendering operations.
The following sample code shows one way to do this.
<pre><code>
/**
* Get rendering hints from a Graphics instance.
* "hintsToSave" is a Map of RenderingHint key-values.
* For each hint key present in that map, the value of that
* hint is obtained from the Graphics and stored as the value
* for the key in savedHints.
*/
RenderingHints getRenderingHints(Graphics2D g2d,
RenderingHints hintsToSave,
RenderingHints savedHints) {
if (savedHints == null) {
savedHints = new RenderingHints(null);
} else {
savedHints.clear();
}
if (hintsToSave.size() == 0) {
return savedHints;
}
/* RenderingHints.keySet() returns Set&lt;Object&gt; */
for (Object o : hintsToSave.keySet()) {
RenderingHints.Key key = (RenderingHints.Key)o;
Object value = g2d.getRenderingHint(key);
savedHints.put(key, value);
}
return savedHints;
}
Toolkit tk = Toolkit.getDefaultToolkit();
Map map = (Map)(tk.getDesktopProperty("awt.font.desktophints"));
Map oldHints;
if (map != null) {
oldHints = getRenderingHints(graphic2D, map, null);
graphics2D.addRenderingHints(map);
..
graphics2D.addRenderingHints(oldHints);
}
</code></pre>
<h3>Details</h3>
<ul>
<li>The return value will always be null or a <code>Map</code>
<br><br>
<li>If the return value is null, then no desktop properties are available,
and dynamic updates will not be available. This is a typical behaviour if
the JDK does not recognise the desktop environment, or it is one which
has no such settings. The <b>Headless</b> toolkit is one such example.
Therefore it is important to test against null before using the map.
<br><br>
<li>If non-null the value will be a <code>Map</code> of
<code>RenderingHints</code> such that every key is an instance of
<code>RenderingHints.Key</code> and the value is a legal value for that key.
<br><br>
<li>The map may contain the default value for a hint. This is
needed in the event there is a previously a non-default value for the hint
set on the <code>Graphics2D</code>. If the map did not contain
the default value, then <code>addRenderingHints(Map)</code> would leave
the previous hint which may not correspond to the desktop setting.
<p>
An application can use <code>setRenderingHints(Map)</code> to reinitialise
all hints, but this would affect unrelated hints too.
<br><br>
<li>A multi-screen desktop may support per-screen device settings in which
case the returned value is for the default screen of the desktop.
An application may want to use the settings for the screen on
which they will be applied.
The per-screen device hints may be obtained by per-device property names
which are constructed as the String concatenation
<pre><code>
"awt.font.desktophints" + "." + GraphicsDevice.getIDstring();
</code></pre>
<p>
An application can also listen for changes on these properties.
<p>
However this is an extremely unlikely configuration, so to help
ease of development, if only a single, desktop-wide setting is supported,
then querying each of these per-device settings will return null.
So to determine if there are per-device settings it is sufficient to
determine that there is a non-null return for any screen device using
the per-device property name.
</ul>
<h2>Mouse Functionality</h2>
<b>Desktop Property: <A name="sun.awt.enableExtraMouseButtons">"sun.awt.enableExtraMouseButtons"</A></b>
<p>
This property determines if events from extra mouse buttons (if they are exist and are
enabled by the underlying operating system) are allowed to be processed and posted into
{@code EventQueue}.
<br>
The value could be changed by passing "sun.awt.enableExtraMouseButtons"
property value into java before application starts. This could be done with the following command:
<pre>
java -Dsun.awt.enableExtraMouseButtons=false Application
</pre>
Once set on application startup, it is impossible to change this value after.
<br>
Current value could also be queried using getDesktopProperty("sun.awt.enableExtraMouseButtons")
method.
<br>
If the property is set to {@code true} then
<ul>
<li> it is still legal to create {@code MouseEvent} objects with
standard buttons and, if the mouse has more
then three buttons, it is also legal to use buttons from the range started
from 0 up to {@link java.awt.MouseInfo#getNumberOfButtons() getNumberOfButtons()}.
<li> it is legal to use standard button masks when using {@code Robot.mousePress()}
and {@code Robot.mouseRelease()} methods and, if the mouse has more then three buttons,
it is also legal to use masks for existing extended mouse buttons.
That way, if there are more then three buttons on the mouse then it is allowed to
use button masks corresponding to the buttons
in the range from 1 up to {@link java.awt.MouseInfo#getNumberOfButtons() getNumberOfButtons()}
</ul>
<br>
If the property is set to {@code false} then
<ul>
<li> it is legal to create {@code MouseEvent} objects with standard buttons
only: {@code NOBUTTON}, {@code BUTTON1}, {@code BUTTON2} and
{@code BUTTON3}
<li> it is legal to use standard button masks only:
{@code InputEvent.BUTTON1_DOWN_MASK}, {@code InputEvent.BUTTON2_DOWN_MASK},
{@code InputEvent.BUTTON3_DOWN_MASK}
</ul>
This property should be used when there is no need in listening mouse events fired as a result of
activity with extra mouse button.
By default this property is set to {@code true}.
</body>
</html>
此差异已折叠。
<!--
Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>The AWT Modality</title>
</head>
<body bgcolor="white">
<h1 align="center">The AWT Modality</h1>
<p>
This document, together with the API documentation for modality-related
classes (such as <code>java.awt.Dialog</code>), briefly describes the new
modality features and how to use them. It contains the following sections:
</p><ul>
<li><a href="#Definitions">Definitions</a></li>
<li><a href="#ModalityTypes">Modality types</a></li>
<li><a href="#ShowHideBlocking">Show/hide blocking</a></li>
<li><a href="#ModalExclusion">Modal exclusion</a></li>
<li><a href="#Related">Related AWT features</a></li>
<li><a href="#Security">Security</a></li>
<li><a href="#PlatformSupport">Platform support</a></li>
<li><a href="#Compatibility">Compatibility</a></li>
<li><a href="#Examples">Examples</a></li>
</ul>
<a name="Definitions"></a>
<h3>Definitions</h3>
<p>
<u>Document</u> - a window without an owner that, together with
all its child hierarchy, may be operated on as a single self-contained
document.
Every window belongs to some document &mdash; its root can be found as
the closest ancestor window without an owner.
</p><p>
<a name="ModalBlocked"></a>
<u>Modal blocked window</u> - a window, that:
</p><ul>
<li>doesn't receive any user input events
</li><li>doesn't receive input focus
</li><li>keeps its Z-order below the modal dialog that blocks it
</li></ul>
<blockquote>
<hr>
<b>Warning!</b> Some window managers allow users to change the window
Z-order in an arbitrary way &mdash; in that case the last requirement
may not be met.
<hr>
</blockquote>
<p>
<u>Modal dialog</u> - a dialog that blocks some windows while it is
visible. The blocked windows are determined according to the dialog's
scope of blocking.
</p><p>
<u>Modal excluded window</u> - a window that stays unblocked
while the modal dialog is visible. If a window is modal excluded
then all its owned windows and child components are also excluded.
</p><p>
<u>Scope of blocking (SB)</u> - the set of windows (instances of
<code>java.awt.Window</code> and all derived classes) that are blocked by
the modal dialog while it is visible.
</p><p>
<blockquote><hr>
<b>Note</b>: Everywhere in this document the notion of "window" is equal
to a top-level window in the Java programming language &mdash; in other words
an instance of <code>java.awt.Window</code> or any descendant class.
<hr></blockquote>
<a name="ModalityTypes"></a>
<h3>Modality types</h3>
<p>
There are four supported modality types :
</p><ul>
<li>toolkit
</li><li>application
</li><li>document
</li><li>modeless
</li></ul>
A dialog is, by default, modeless. A modal dialog is, by default,
application-modal.
<p>
</p><ol>
<li><u>Modeless dialogs</u><br>
A modeless dialog doesn't block any windows while visible.
</li><li><u>Document-modal dialogs</u><br>
A document-modal dialog blocks all windows from the same
document except those from its child hierarchy. The document root
is determined as the closest ancestor window without an
owner.
</li><li><u>Application-modal dialogs</u><br>
An application-modal dialog blocks all windows from the same
application except for those from its child hierarchy.
If there are several applets launched in a browser, they can be
treated either as separate applications or a single application.
This behavior is implementation-dependent.
</li><li><u>Toolkit-modal dialogs</u><br>
A toolkit-modal dialog blocks all windows that run in the same
toolkit except those from its child hierarchy. If there
are several applets launched all of them run with the same toolkit,
so a toolkit-modal dialog shown from an applet may affect other
applets and all windows of the browser instance which embeds the
Java runtime environment for this toolkit.
See the security section below.
</li></ol>
<p>
Modality priority is arranged by the strength of blocking: modeless,
document-modal, application-modal and toolkit-modal. This arrangement
is used when determining what dialog should remain unblocked if two
are visible and block each other. It naturally reflects the nesting
of a dialog's scope of blocking (SB): a modeless dialog has an empty SB,
a document-modal dialog's SB is complete in some applications,
and all the applications are run in one toolkit. </p><p>
Notes about owners:
</p><ul>
<li>Creating a document-modal dialog without an owner:<br>
Since <code>Dialog</code> is a class derived from
<code>Window</code>, a <code>Dialog</code> instance automatically
becomes the root of the document if it has no owner. Thus, if
such a dialog is document-modal, its scope of blocking is empty
and it behaves the same way as a modeless dialog.
</li><li>Creating an application-modal or toolkit-modal dialog with an
owner:<br>
The scope of blocking for an application- or toolkit-modal
dialog, as opposed to a document-modal dialog, doesn't depend on
its owner. Thus, in this case the only thing that the owner
affects is the Z-order: the dialog always stays on top of its owner.
</li></ul>
<p>
<blockquote><hr>
<b>Implementation note</b>: Changing the modality type for a visible
dialog may have no effect until it is hidden and then shown again.
<hr></blockquote>
<a name="ShowHideBlocking"></a>
<h3>Show/hide blocking</h3>
<p>
<u>Showing the window or modeless dialog: "F"</u><br>
All the visible modal dialogs are looked through &mdash; if F is from the SB
of one of them, it becomes blocked by it. If there are several such
dialogs, the first shown is used. If no such dialogs exist, F remains
unblocked.
</p><p>
<u>Showing the modal dialog: "M"</u><br>
When modal dialog M is shown, all the visible windows fall into one of
three distinct groups:
<ul>
<li>Blockers of M (modal dialogs that block M and
either are in M's child hierarchy, or are not blocked by M, or have
a greater mode of modality, or block some other blocker of M)
<li>Blocked by M (windows from M's SB that are not blockers and are
not in child hierarchy of any blocker)
<li>All other windows (windows or modeless
dialogs outside M's SB and modal dialogs outside M's SB that do not
block M).
</ul>
<p>
After the modal dialog M is shown, it becomes blocked by the first shown
dialog from the first group (if there are any), all the windows from the
second one become blocked by M, and all the windows from the third group
remain untouched.
</p><p>
<u>In typical cases</u>, when no child dialogs are shown before their owners,
this rule can be simplified. (The following, simplified case, may
leave out some details).
</p><p>
<u>Showing the document-modal dialog: "M"</u><br>
All the visible application- and toolkit-modal dialogs are looked
through &mdash; if M is from the SB of one of them,
it becomes blocked by it. If there are several such dialogs,
the first shown is used. If no such dialogs exist, M remains unblocked.
</p><p>
<u>Showing the application-modal dialog: "M"</u><br>
All the visible toolkit-modal dialogs are looked through &mdash;
if M is from the SB of one of them, it becomes blocked by it.
If there are several such dialogs, the first shown is used.
If no such dialogs exist, M remains unblocked.
</p><p>
<u>Showing the toolkit-modal dialog: "M"</u><br>
M remains unblocked.
</p><p>
<!-- <center> -->
</p>
<table border="1">
<caption>The Standard Blocking Matrix</caption>
<tbody><tr align="center">
<td align="center">current/shown</td>
<td align="center">frame &amp; modeless</td>
<td align="center">document</td>
<td align="center">application</td>
<td align="center">toolkit</td>
</tr>
<tr align="center">
<td align="center">-</td>
<td align="center">-</td>
<td align="center">-</td>
<td align="center">-</td>
<td align="center">-</td>
</tr>
<tr align="center">
<td align="center">document</td>
<td align="center">blocked</td>
<td align="center">-</td>
<td align="center">-</td>
<td align="center">-</td>
</tr>
<tr align="center">
<td align="center">application</td>
<td align="center">blocked</td>
<td align="center">blocked</td>
<td align="center">-</td>
<td align="center">-</td>
</tr>
<tr align="center">
<td align="center">toolkit</td>
<td align="center">blocked</td>
<td align="center">blocked</td>
<td align="center">blocked</td>
<td align="center">-</td>
</tr>
</tbody></table>
<!-- </center> -->
<p>
After the modal dialog is shown, all the windows from its SB are blocked,
except those that block this modal dialog.
</p><p>
<u>Hiding the window or modeless dialog: "F"</u><br>
If F was blocked by any modal dialog M, it becomes unblocked and is
removed from M's blocked windows list.
</p><p>
<u>Hiding the modal dialog: "M"</u><br>
If M was blocked by any other modal dialog, for example, "N",
it becomes unblocked and
is removed from N's blocked windows list. Then, all the windows and dialogs
blocked by M become unblocked, and after that the same checks
(as in Showing the modal dialog: "M")
are performed for each of them in the order they were initially shown.
<a name="ModalExclusion"></a>
</p><h3>Modal exclusion</h3>
<p>
There are two modal exclusion types introduced as of JDK 6
</p><ul>
<li>Exclusion from blocking of toolkit-modal dialogs
</li><li>Exclusion from blocking of application-modal dialogs
</li></ul>
By default, a window's modal exclusion property is turned off.
<p>
</p><ol>
<li><u>Application-modal exclusion</u><br>
If a window is application-modal excluded, it is not blocked by any
application-modal dialogs. Also, it is not blocked by document-modal
dialogs from outside of its child hierarchy.
</li><li><u>Toolkit-modal exclusion</u><br>
If a window is toolkit-modal excluded, it is not blocked
by any application- or toolkit-modal dialogs. Also, it is not
blocked by document-modal dialogs from outside of their child hierarchy.
</li></ol>
<p>
<blockquote>
<hr>
<b>Implementation note</b>: Changing the modal exclusion type for a visible window
may have no effect until it is hidden and then shown again.
</blockquote>
<a name="Related"></a>
<h3>Related AWT features</h3>
<p>
<u>Always-On-Top</u><br>
When a modal dialog that is not always-on-top blocks an always-on-top window,
their relative Z-order is unspecified and platform-dependent.
</p>
<p>
<u>The <code>toFront()</code> and <code>toBack()</code> methods</u><br>
A modal dialog should always be above all its blocked windows. Thus, if a blocked
window is brought to the front, its blocking dialog, if any, is also brought to the
front and remains above the blocked window. Likewise, if a modal dialog is sent to
the back, all of its blocked windows are sent to the back to keep them below the
blocking dialog.
</p>
<p>
<u>Minimizing, maximizing and closing blocked windows</u><br>
When a modal dialog blocks a window, the user may not be able to maximize or
minimize the blocked window&mdash; however, the actual behavior is unspecified
and platform-dependent. In any case, the user can't close the blocked window
interactively&mdash; but it can be closed programmatically by calling the
<code>setVisible(false)</code> or <code>dispose()</code> methods on the blocked
window.
</p>
<p>
<u>Blocked windows activations</u><br>
When the user selects a blocked window, it may be brought to the front, along
with the blocking modal dialog which would then become the active window&mdash;
however, the actual behavior is unspecified and platform-dependent.
</p>
<p>
<u>Hiding a modal dialog</u><br>
When the modal dialog that currently has focus is hidden, it is unspecified
and platform-dependent, which other window will become the active window.
Any of the following may become the active window:
<ol>
<li>The owner of the modal dialog - if the owner is unblocked.
</li><li>The <code>Window</code>, which was active before this modal dialog gained
focus - if the owner of the modal dialog is absent or is blocked.
</li></ol>
If the modal dialog to be hidden does not have focus, the active window remains
unchanged.
<a name="Security"></a>
<h3>Security</h3>
<p>
A special <code>AWTPermission</code>, <code>"toolkitModality"</code>,
is required to show toolkit-modal
dialogs. This would prevent, for example, blocking a browser or
Java Web Start (JWS) by modal dialogs shown from applets.
</p><p>
The same permission is required to exclude a window from toolkit modality.
This would prevent, for example, a dialog shown from an applet not to be
blocked by a browser's or JWS's modal dialog.
<a name="PlatformSupport"></a>
</p><h3>Platform support</h3>
<p>
Two <code>java.awt.Toolkit</code> methods allow you to check whether
the current platform supports specific modality features:
</p><ul>
<li><code>isModalityTypeSupported(modalityType)</code><br>
Returns whether the specified modality type is supported on
the current platform.
If mode "M" is not supported and a dialog is set to M-modal,
it behaves as modeless.
</li>
<li><code>isModalExclusionTypeSupported(modalExclusionType)</code><br>
Returns whether the given modal exclusion type is supported on
the current platform. If exclusion type "E" is not supported
and a window is marked as E-excluded, this has no effect.
</li></ul>
<a name="Compatibility"></a>
<h3>Compatibility</h3>
<p>
The default modality type is application-modal. It is used by the API
calls: <code>Dialog.setModal(true)</code>,
<code>Dialog(owner, true)</code>, etc. Prior to JDK 6
the default type was toolkit-modal,
but the only distinction between application- and toolkit-modality is for
applets and applications launched from Java Web Start.
<a name="Examples"></a>
</p><h3>Examples</h3>
<table border="0">
<tbody><tr>
<td align="left" >
<ol>
<li>Frame "F" is shown<br>
<li>Document-modal dialog "D<sub>i</sub>" is shown<br>
<li>F becomes blocked by D<sub>i</sub> &mdash; it's in the same document<br>
<li>Document-modal dialog "D<sub>ii</sub>" is shown<br>
<li>D<sub>i</sub> becomes blocked by D<sub>ii</sub> &mdash; it's in the
same document<br>
</ol>
<br>
</td>
<td align="center">
<img src="modal-example1.gif">
<br>
</td>
</tr>
<tr>
<td align="left">
<ol>
<li>Frame "F" is shown<br>
<li>Document-modal dialog "D<sub>i</sub>" is shown<br>
<li>F becomes blocked by D<sub>i</sub> &mdash; it's in the same document<br>
<li>Document-modal dialog "D<sub>ii</sub>" is shown<br>
<li>D<sub>i</sub> becomes blocked by D<sub>ii</sub> &mdash;
it's in the same document<br>
<li>D<sub>i</sub> is hidden<br>
<li>F becomes blocked by D<sub>ii</sub> &mdash; it's in the same document<br>
</ol>
<br>
</td>
<td align="center">
<img src="modal-example2.gif">
<br>
</td>
</tr>
<tr>
<td align="left">
<ol>
<li>Frame "F" is shown<br>
<li>Toolkit-modal dialog "D<sub>i</sub>" is created, but not shown<br>
<li>Document-modal dialog "D<sub>ii</sub>" is shown<br>
<li>F becomes blocked by D<sub>ii</sub> &mdash; it's in the same document<br>
<li>Application-modal dialog "D<sub>iii</sub>" is shown<br>
<li>D<sub>ii</sub> becomes blocked by D<sub>iii</sub> &mdash;
it's in the same application<br>
<li>D<sub>i</sub> is shown<br>
<li>D<sub>i</sub> becomes blocked by D<sub>ii</sub> &mdash; it's its owner<br>
<li>D<sub>iii</sub> remains unblocked &mdash; it blocks D<sub>ii</sub> and
D<sub>ii</sub> blocks D<sub>i</sub><br>
</ol>
<br>
</td>
<td align="center">
<img src="modal-example3.gif">
<br>
</td>
</tr>
<tr>
<td align="left">
<ol>
<li>Frame "F" is shown<br>
<li>Toolkit-modal dialog "D<sub>i</sub>" is created, but not shown<br>
<li>Document-modal dialog "D<sub>ii</sub>" is shown<br>
<li>F becomes blocked by D<sub>ii</sub> &mdash; it's in the same document<br>
<li>Application-modal dialog "D<sub>iii</sub>" is shown<br>
<li>D<sub>ii</sub> becomes blocked by D<sub>iii</sub> &mdash; it's in the
same application<br>
<li>D<sub>i</sub> is shown<br>
<li>D<sub>iii</sub> becomes blocked by D<sub>i</sub> &mdash; D<sub>i</sub>
is not blocked<br>
<li>D<sub>i</sub> remains unblocked<br>
</ol>
<br>
</td>
<td align="center">
<img src="modal-example4.gif">
<br>
</td>
</tr>
</tbody></table>
</body></html>
<!--
Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head><title></title></head>
<body bgcolor="white">
Provides interfaces and classes for dealing with different
types of events fired by AWT components. See the java.awt.AWTEvent
class for details on the AWT event model. Events are fired by event
sources. An event listener registers with an event source to receive
notifications about the events of a particular type. This package
defines events and event listeners, as well as event listener
adapters, which are convenience classes to make easier the process of
writing event listeners.
<!--
<h2>Package Specification</h2>
##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
<ul>
<li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
</ul>
<h2>Related Documentation</h2>
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
</ul>
-->
@since JDK1.1
</body>
</html>
<!--
Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head><title></title></head>
<body bgcolor="white">
Provides classes and interface relating to fonts. It
contains support for representing Type 1, Type 1 Multiple Master
fonts, OpenType fonts, and TrueType fonts.
<!--
<h2>Package Specification</h2>
##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
<ul>
<li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
</ul>
<h2>Related Documentation</h2>
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
</ul>
-->
@since 1.2
</body>
</html>
<!--
Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head><title></title></head>
<body bgcolor="white">
Provides the Java 2D classes for defining and performing operations
on objects related to two-dimensional geometry. Some important features
of the package include:
<ul>
<li>classes for manipulating geometry, such as AffineTransform and
the PathIterator interface which is implemented by all Shape objects.
<li>classes that implement the Shape interface, such as
CubicCurve2D, Ellipse2D, Line2D, Rectangle2D, and GeneralShape.
<li>the Area class which provides mechanisms for add (union), subtract,
intersect, and exclusiveOR operations on other Shape objects.
</ul>
<!--
<h2>Package Specification</h2>
##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
<ul>
<li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
</ul>
<h2>Related Documentation</h2>
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
</ul>
-->
@since 1.2
</body>
</html>
<!--
Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME=GENERATOR CONTENT="Claris Home Page 2.0">
<X-SAS-WINDOW TOP=42 BOTTOM=589 LEFT=4 RIGHT=534>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<P>Provides classes and interfaces for the input method framework.
This package enables text editing components to receive text input
through input methods. Input methods are software components that let
the user enter text in ways other than simple typing on a keyboard.
They are commonly used to enter Japanese, Chinese, or Korean -
languages using thousands of different characters - on keyboards with
far fewer keys. However, the framework also supports input methods
for other languages and the use of entirely different input
mechanisms, such as handwriting or speech recognition.</P>
<H2>Package Specification</H2>
<UL>
<LI><B><A HREF="{@docRoot}/../technotes/guides/imf/spec.html">Input Method
Framework Specification</A></B>
<LI><B><A HREF="{@docRoot}/../technotes/guides/imf/api-reference.html">Input
Method Client API Reference</A></B>
</UL>
<H2>Related Documentation</H2>
<P>For overviews, tutorials, examples, guides, and tool
documentation, please see:</P>
<UL>
<LI><B><A HREF="{@docRoot}/../technotes/guides/imf/overview.html">Input Method
Framework Overview</A></B>
<LI><B><A HREF="{@docRoot}/../technotes/guides/imf/api-tutorial.html">Input
Method Client API Tutorial</A></B>
</UL>
@since 1.2
</BODY>
</HTML>
<!--
Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--This file created 7/22/1999 11:47 by Claris Home Page version 2.0-->
<HTML>
<HEAD>
<TITLE>Package java.awt.im.spi Description</TITLE>
<META NAME=GENERATOR CONTENT="Claris Home Page 2.0">
<X-SAS-WINDOW TOP=51 BOTTOM=592 LEFT=171 RIGHT=701>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<P>Provides interfaces that enable the development of input methods
that can be used with any Java runtime environment. Input methods are
software components that let the user enter text in ways other than
simple typing on a keyboard. They are commonly used to enter
Japanese, Chinese, or Korean - languages using thousands of different
characters - on keyboards with far fewer keys. However, this package
also allows the development of input methods for other languages and
the use of entirely different input mechanisms, such as handwriting
recognition.</P>
<H2><A NAME="package_specification"></A>Package Specification</H2>
<UL>
<LI><B><A HREF="../../../../../technotes/guides/imf/spec.html">Input Method
Framework Specification</A></B>
<LI><B><A HREF="../../../../../technotes/guides/imf/spi-reference.html">Input
Method Engine SPI Reference</A></B>
</UL>
<H4><A NAME="Packaging"></A>Packaging Input Methods</H4>
<P>Input methods are packaged as installed extensions, as specified
by the <A HREF="../../../../../technotes/guides/extensions/index.html">Extension
Mechanism</A>. The main JAR file of an input method must contain the
file:</P>
<PRE> META-INF/services/java.awt.im.spi.InputMethodDescriptor</PRE>
<P>The file should contain a list of fully-qualified class names, one
per line, of classes implementing the
<CODE>java.awt.im.spi.InputMethodDescriptor</CODE> interface. Space
and tab characters surrounding each name, as well as blank lines, are
ignored. The comment character is <CODE>'#'</CODE>
(<CODE>\u0023</CODE>); on each line all characters following the
first comment character are ignored. The file must be encoded in
UTF-8.</P>
<P>For example, if the fully-qualified name of the class that
implements <CODE>java.awt.im.spi.InputMethodDesciptor</CODE> for the
<EM>Foo</EM> input method is
<CODE>com.sun.ime.FooInputMethodDescriptor</CODE>, the file
<CODE>META-INF/services/java.awt.im.spi.InputMethodDescriptor</CODE>
contains a line:</P>
<PRE> com.sun.ime.FooInputMethodDescriptor</PRE>
<P>The input method must also provide at least two classes: one class
implementing the <CODE>java.awt.im.spi.InputMethodDescriptor</CODE>
interface, one class implementing the
<CODE>java.awt.im.spi.InputMethod</CODE> interface. The input method
should separate the implementations for these interfaces, so that
loading of the class implementing <CODE>InputMethod</CODE> can be
deferred until actually needed.</P>
<H4><A NAME="Loading"></A>Loading Input Methods</H4>
<P>The input method framework will usually defer loading of input
method classes until they are absolutely needed. It loads only the
<CODE>InputMethodDescriptor</CODE> implementations during AWT
initialization. It loads an <CODE>InputMethod</CODE> implementation
when the input method has been selected.</P>
<H4><A NAME="PeeredComponents"></A>Java Input Methods and Peered Text
Components</H4>
<P>The Java input method framework intends to support all
combinations of input methods (host input methods and Java input
methods) and components (peered and lightweight). However, because of
limitations in the underlying platform, it may not always be possible
to enable the communication between Java input methods and peered AWT
components. Support for this specific combination is therefore
platform dependent. In Sun's Java SE Runtime Environments, this
combination is supported on Windows, but not on Solaris.</P>
<H2>Related Documentation</H2>
<P>For overviews, tutorials, examples, guides, and tool
documentation, please see:</P>
<UL>
<LI><B><A HREF="../../../../../technotes/guides/imf/overview.html">Input
Method Framework Overview</A></B>
<LI><B><A HREF="../../../../../technotes/guides/imf/spi-tutorial.html">Input
Method Engine SPI Tutorial</A></B>
</UL>
@since JDK1.3
</BODY>
</HTML>
<!--
Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head><title></title></head>
<body bgcolor="white">
Provides classes for creating and modifying images.
Images are processed using a streaming framework that involves an
image producer, optional image filters, and an image consumer. This
framework makes it possible to progressively render an image while it
is being fetched and generated. Moreover, the framework allows an
application to discard the storage used by an image and to regenerate
it at any time. This package provides a number of image producers,
consumers, and filters that you can configure for your image
processing needs.
<!--
<h2>Package Specification</h2>
##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
<ul>
<li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
</ul>
<h2>Related Documentation</h2>
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
</ul>
-->
@since JDK1.0
</body>
</html>
<!--
Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head><title></title></head>
<body bgcolor="white">
Provides classes and interfaces for producing
rendering-independent images.
<!--
<h2>Package Specification</h2>
##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
<ul>
<li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
</ul>
<h2>Related Documentation</h2>
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
</ul>
-->
@since 1.2
</body>
</html>
<!--
Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head><title></title></head>
<body bgcolor="white">
Contains all of the classes for creating user
interfaces and for painting graphics and images. A user interface object such as a button or a
scrollbar is called, in AWT terminology, a component. The Component class is the root of all
AWT components. See Component for a detailed description of properties that all AWT
components share.
<p>
Some components fire events when a user interacts with the components. The AWTEvent
class and its subclasses are used to represent the events that AWT components can fire. See
AWTEvent for a description of the AWT event model.
<p>
A container is a component that can contain components and other containers. A con
tainer can also have a layout manager that controls the visual placement of components in the
container. The AWT package contains several layout manager classes and an interface for
building your own layout manager. See Container and LayoutManager for more information.
<p>
Each {@code Component} object is limited in its maximum size and
its location because the values are stored as an integer.
Also, a platform may further restrict maximum size and location
coordinates. The exact maximum values are dependent on the platform.
There is no way to change these maximum values, either in Java
code or in native code.
These limitations also impose restrictions on component layout.
If the bounds of a Component object exceed a platform limit,
there is no way to properly arrange them within a Container object.
The object's bounds are defined by any object's coordinate
in combination with its size on a respective axis.
<h2>Additional Specification</h2>
<ul>
<li><a href="doc-files/FocusSpec.html">The AWT Focus Subsystem</a>
<li><a href="doc-files/Modality.html">The AWT Modality</a>
</ul>
<!--
<h2>Package Specification</h2>
##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
<ul>
<li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
</ul>
<h2>Related Documentation</h2>
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
</ul>
-->
@since JDK1.0
</body>
</html>
<!--
Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<body bgcolor="white">
Provides for interfacing with the underlying window system.
It is for accessing the platform-specific facilities in order to
build AWT toolkits. It is only used by AWT toolkit developers.
<h2>Package Specification</h2>
##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
<ul>
<li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
</ul>
<h2>Related Documentation</h2>
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
</ul>
</body>
</html>
<!--
Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head><title></title></head>
<body bgcolor="white">
Provides classes and interfaces for a general printing API. The
API includes such features as:
<ul>
<li>the ability to specify document types
<li>mechanisms for control of page setup and page formats
<li>the ability to manage job control dialogs
</ul>
<!--
<h2>Package Specification</h2>
##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
<ul>
<li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
</ul>
<h2>Related Documentation</h2>
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
</ul>
-->
@since 1.2
</body>
</html>
<!--
Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<body bgcolor="white">
Provides classes and interfaces relating to bean context.
A bean context is a container for beans and defines the execution
environment for the beans it contains. There can be several beans in
a single bean context, and a bean context can be nested within another
bean context. This package also contains events and listener
interface for beans being added and removed from a bean context.
<!--
<h2>Package Specification</h2>
##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
<ul>
<li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
</ul>
<h2>Related Documentation</h2>
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
</ul>
-->
@since 1.2
</body>
</html>
<!--
Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<body bgcolor="white">
Contains classes related to developing
<em>beans</em> -- components
based on the JavaBeans&trade; architecture.
A few of the
classes are used by beans while they run in an application.
For example, the event classes are
used by beans that fire property and vetoable change
events (see
{@link java.beans.PropertyChangeEvent}). However, most of the classes in this
package are meant to be used by a bean editor (that is, a development environment
for customizing and putting together beans to create an application). In
particular, these classes help the bean editor create a user
interface that the user can use to customize the bean. For example, a bean may
contain a property of a special type that a bean editor may not know how to handle.
By using the <code>PropertyEditor</code> interface, a bean developer can
provide an editor for this special type.
<p>
To minimize the resources used by a bean, the classes used by bean editors are loaded only
when the bean is being edited. They are not needed while the bean is running in an application
and therefore not loaded. This information is kept in what's called a bean-info (see {@link java.beans.BeanInfo}).
<p>
Unless explicitly stated, null values or empty Strings are not valid
parameters for the methods in this package. You may expect to see
exceptions if these parameters are used.
<h2>Long-Term Persistence</h2>
As of v1.4,
the <code>java.beans</code> package provides support for
<em>long-term persistence</em> -- reading and
writing a bean as a textual representation of its property values.
The property values are treated as beans,
and are recursively read or written to capture
their publicly available state.
This approach is suitable for long-term storage
because it relies only on public API,
rather than the likely-to-change private implementation.
<blockquote>
<hr>
<b>Note:</b>
The persistence scheme cannot automatically instantiate
custom inner classes, such as you might use for event handlers.
By using the {@link java.beans.EventHandler} class
instead of inner classes for custom event handlers,
you can avoid this problem.
<hr>
</blockquote>
<p>
You read and write beans in XML format using the
{@link java.beans.XMLDecoder}
and
{@link java.beans.XMLEncoder}
classes, respectively.
One notable feature of the persistence scheme is that
reading in a bean requires no special knowledge of the bean.
<p>
Writing out a bean, on the other hand,
sometimes requires special knowledge of the bean's type.
If the bean's state can be
expressed using only the no-argument constructor and
public getter and setter methods for properties,
no special knowledge is required.
Otherwise, the bean requires a custom <em>persistence delegate</em> --
an object that is in charge of writing out beans of a particular type.
All classes provided in the JDK that descend
from <code>java.awt.Component</code>,
as well as all their properties,
automatically have persistence delegates.
<p>
If you need (or choose) to provide a persistence delegate for a bean,
you can do so either by using a
{@link java.beans.DefaultPersistenceDelegate}
instance
or by creating your own subclass of <code>PersistenceDelegate</code>.
If the only reason a bean needs a persistence delegate
is because you want to invoke the bean's constructor with
property values as arguments,
you can create the bean's persistence delegate
with the one-argument
<code>DefaultPersistenceDelegate</code>
constructor.
Otherwise,
you need to implement your own persistence delegate,
for which you're likely to need the following classes:
<dl>
<dt> {@link java.beans.PersistenceDelegate}
<dd> The abstract class from which all persistence delegates descend.
Your subclass should use its knowledge of the bean's type to provide
whatever <code>Statement</code>s and <code>Expression</code>s
are necessary to create the bean
and restore its state.
<dt> {@link java.beans.Statement}
<dd> Represents the invocation of a single method on an object.
Includes a set of arguments to the method.
<dt> {@link java.beans.Expression}
<dd> A subclass of <code>Statement</code>
used for methods that return a value.
</dl>
<p>
Once you create a persistence delegate,
you register it using the
<code>setPersistenceDelegate</code> method of
<code>XMLEncoder</code>.
<h2>Related Documentation</h2>
For overview, architecture, and tutorial documentation, please see:
<ul>
<li><a href="http://docs.oracle.com/javase/tutorial/javabeans/">JavaBeans</a>, a trail in <em>The Java Tutorial</em>.
<li><a href="http://www.oracle.com/technetwork/java/persistence2-141443.html">Long-Term Persistence</a>, an article in <em>The Swing Connection</em>.
</ul>
<p>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<!--
Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<body bgcolor="white">
Provides for system input and output through data streams,
serialization and the file system.
Unless otherwise noted, passing a null argument to a constructor
or method in any class or interface in this package will cause a
<tt>NullPointerException</tt> to be thrown.
<h2>Package Specification</h2>
<ul>
<li><a href="../../../platform/serialization/spec/serialTOC.html"> Java Object Serialization Specification </a>
</ul>
<h2>Related Documentation</h2>
For overviews, tutorials, examples, guides, and tool documentation,
please see:
<ul>
<li><a href="../../../technotes/guides/serialization">Serialization Enhancements</a>
</ul>
@since JDK1.0
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<title>Value-based Classes</title>
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
</head>
<body>
<h2 id="ValueBased">Value-based Classes</h2>
Some classes, such as <code>java.util.Optional</code> and
<code>java.time.LocalDateTime</code>, are <em>value-based</em>. Instances of a
value-based class:
<ul>
<li>are final and immutable (though may contain references to mutable
objects);</li>
<li>have implementations of <code>equals</code>,
<code>hashCode</code>, and <code>toString</code> which are computed
solely from the instance's state and not from its identity or the state
of any other object or variable;</li>
<li>make no use of identity-sensitive operations such as reference
equality (<code>==</code>) between instances, identity hash code of
instances, or synchronization on an instances's intrinsic lock;</li>
<li>are considered equal solely based on <code>equals()</code>, not
based on reference equality (<code>==</code>);</li>
<li>do not have accessible constructors, but are instead instantiated
through factory methods which make no committment as to the identity
of returned instances;</li>
<li>are <em>freely substitutable</em> when equal, meaning that interchanging
any two instances <code>x</code> and <code>y</code> that are equal
according to <code>equals()</code> in any computation or method
invocation should produce no visible change in behavior.
</li>
</ul>
<p>A program may produce unpredictable results if it attempts to distinguish two
references to equal values of a value-based class, whether directly via reference
equality or indirectly via an appeal to synchronization, identity hashing,
serialization, or any other identity-sensitive mechanism. Use of such
identity-sensitive operations on instances of value-based classes may have
unpredictable effects and should be avoided.</p>
</body>
</html>
<!--
Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
Copyright 2003 Wily Technology, Inc.
-->
</head>
<body bgcolor="white">
Provides services that allow Java programming language agents to instrument programs running on the JVM.
The mechanism for instrumentation is modification of the byte-codes of methods.
<h2>Package Specification</h2>
<P>
An agent is deployed as a JAR file. An attribute in the JAR file manifest specifies the
agent class which will be loaded to start the agent. For implementations that support a command-line
interface, an agent is started by specifying an option on the command-line.
Implementations may also support a mechanism to start agents some time after the VM has
started. For example, an implementation may provide a mechanism that allows a tool to
<i>attach</i> to a running application, and initiate the loading of the tool's agent into
the running application. The details as to how the load is initiated, is implementation
dependent.
<h3>Command-Line Interface</h3>
<P>
An implementation is not required to provide a way to start agents from the
command-line interface. On implementations that do provide a way to start agents
from the command-line interface, an agent is started by adding this option to
the command-line:
<blockquote>
<code><b>-javaagent:</b></code><i>jarpath[</i><code><b>=</b></code><i>options]</i>
</blockquote>
<i>jarpath</i> is the path to the agent JAR file.
<i>options</i> is the agent options.
This switch may be used multiple times on the same command-line,
thus creating multiple agents.
More than one agent may use the same <i>jarpath</i>.
An agent JAR file must conform to the JAR file specification.
<P>
The manifest of the agent JAR file must contain the attribute <code>Premain-Class</code>. The
value of this attribute is the name of the <i>agent class</i>. The agent class must implement a
public static <code>premain</code> method similar in principle to the <code>main</code> application
entry point. After the Java Virtual Machine (JVM) has initialized, each <code>premain</code> method
will be called in the order the agents were specified, then the real application
<code>main</code> method will be called.
Each <code>premain</code> method must return in order for the startup sequence to proceed.
<P>
The <code>premain</code> method has one of two possible signatures. The JVM first attempts to
invoke the following method on the agent class:
<blockquote>
<code>public static void
premain(String agentArgs, Instrumentation inst);
</code>
</blockquote>
<P>
If the agent class does not implement this method then the JVM will attempt to invoke:
<blockquote>
<code>public static void
premain(String agentArgs);
</code>
</blockquote>
<P>
The agent class may also have an <code>agentmain</code> method for use when the agent is started
after VM startup. When the agent is started using a command-line option, the <code>agentmain</code>
method is not invoked.
<P>
The agent class will be loaded by the system class loader
(see {@link java.lang.ClassLoader#getSystemClassLoader ClassLoader.getSystemClassLoader}). This is
the class loader which typically loads the class containing the application <code>main</code> method.
The <code>premain</code> methods will be run under the same security and classloader
rules as the application <code>main</code> method.
There are no modeling restrictions on what the agent <code>premain</code> method may do.
Anything application <code>main</code> can do, including creating threads, is legal from <code>premain</code>.
<P>
Each agent is passed its agent options via the <code>agentArgs</code> parameter.
The agent options are passed as a single string,
any additional parsing should be performed by the agent itself.
<P>
If the agent cannot be resolved
(for example, because the agent class cannot be loaded,
or because the agent class does not have an appropriate <code>premain</code> method), the JVM will abort.
If a <code>premain</code> method throws an uncaught exception, the JVM will abort.
<h3>Starting Agents After VM Startup</h3>
<p>
An implementation may provide a mechanism to start agents sometime after the
the VM has started. The details as to how this is initiated are implementation
specific but typically the application has already started and its <code>
main</code> method has already been invoked. In cases where an implementation
supports the starting of agents after the VM has started the following applies:
<ol>
<li><p>The manifest of the agent JAR must contain the attribute <code>Agent-Class</code>.
The value of this attribute is the name of the <i>agent class</i>. </p></li>
<li><p>The agent class must implement a public static <code>agentmain</code> method. </p></li>
<li><p>The system class loader (
{@link java.lang.ClassLoader#getSystemClassLoader ClassLoader.getSystemClassLoader}) must
support a mechanism to add an agent JAR file to the system class path. <p></li>
</ol>
<P>
The agent JAR is appended to the system class path. This is the class loader that typically loads
the class containing the application <code>main</code> method. The agent class is loaded and the
JVM attempts to invoke the <code>agentmain</code> method. The JVM first attempts to invoke
the following method on the agent class:
<blockquote>
<code>public static void
agentmain(String agentArgs, Instrumentation inst);
</code>
</blockquote>
<P>
If the agent class does not implement this method then the JVM will attempt to invoke:
<blockquote>
<code>public static void
agentmain(String agentArgs);
</code>
</blockquote>
<P>
The agent class may also have an <code>premain</code> method for use when the agent is started
using a command-line option. When the agent is started after VM startup the <code>premain</code>
method is not invoked.
<P>
The agent is passed its agent options via the <code>agentArgs</code> parameter.
The agent options are passed as a single string,
any additional parsing should be performed by the agent itself.
<P>
The <code>agentmain</code> method should do any necessary initialization
required to start the agent. When startup is complete the method should
return. If the agent cannot be started
(for example, because the agent class cannot be loaded,
or because the agent class does not have a conformant <code>agentmain</code> method), the JVM will
not abort. If the <code>agentmain</code> method throws an uncaught exception it will be ignored.
<h3>Manifest Attributes</h3>
The following manifest attributes are defined for an agent JAR file:
<blockquote>
<dl>
<dt><code>Premain-Class</code></dt>
<dd>
When an agent is specified at JVM launch time this attribute
specifies the agent class.
That is, the class containing the <code>premain</code> method.
When an agent is specified at JVM launch time this attribute
is required. If the attribute is not present the JVM will abort.
Note: this is a class name, not a file name or path.
</dd>
<dt><code>Agent-Class</code></dt>
<dd>
If an implementation supports a mechanism to start agents
sometime after the VM has started then this attribute specifies
the agent class.
That is, the class containing the <code>agentmain</code> method.
This attribute is required, if it is not present the agent
will not be started.
Note: this is a class name, not a file name or path.
</dd>
<dt><code>Boot-Class-Path</code></dt>
<dd>
A list of paths to be searched by the bootstrap class
loader. Paths represent directories or libraries
(commonly referred to as JAR or zip libraries on
many platforms).
These paths are searched by the
bootstrap class loader after the platform specific
mechanisms of locating a class have failed.
Paths are searched in the order listed.
Paths in the list are separated by one or more spaces.
A path takes the syntax of the path component of a
hierarchical URI. The path is
absolute if it begins with a slash character ('/'),
otherwise it is relative. A relative path is resolved
against the absolute path of the agent JAR file.
Malformed and non-existent paths are ignored.
When an agent is started sometime after the VM has
started then paths that do not represent a JAR file
are ignored.
This attribute is optional.
</dd>
<dt><code>Can-Redefine-Classes</code></dt>
<dd>
Boolean (<code>true</code> or <code>false</code>, case irrelevant).
Is the ability to redefine classes
needed by this agent.
Values other than <code>true</code> are considered <code>false</code>.
This attribute is optional, the default is <code>false</code>.
</dd>
<dt><code>Can-Retransform-Classes</code></dt>
<dd>
Boolean (<code>true</code> or <code>false</code>, case irrelevant).
Is the ability to retransform classes
needed by this agent.
Values other than <code>true</code> are considered <code>false</code>.
This attribute is optional, the default is <code>false</code>.
</dd>
<dt><code>Can-Set-Native-Method-Prefix</code></dt>
<dd>
Boolean (<code>true</code> or <code>false</code>, case irrelevant).
Is the ability to set native method prefix needed by this agent.
Values other than <code>true</code> are considered <code>false</code>.
This attribute is optional, the default is <code>false</code>.
</dd>
</dl>
</blockquote>
<p>
An agent JAR file may have both the <code>Premain-Class</code> and <code>Agent-Class</code>
attributes present in the manifest. When the agent is started on the command-line using
the <code>-javaagent</code> option then the <code>Premain-Class</code> attribute
specifies the name of the agent class and the <code>Agent-Class</code> attribute is
ignored. Similarly, if the agent is started sometime after the VM has started, then
the <code>Agent-Class</code> attribute specifies the name of the agent class
(the value of <code>Premain-Class</code> attribute is ignored).
<h2>Related Documentation</h2>
For tool documentation, please see:
<ul>
<li><a href="{@docRoot}/../technotes/tools/index.html">JDK Tools and Utilities</a>
</ul>
@since JDK1.5
@revised 1.6
</body>
</html>
<!--
Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<body bgcolor="white">
Provides the management interfaces for monitoring and management of the
Java virtual machine and other components in the Java runtime.
It allows both local and remote
monitoring and management of the running Java virtual machine.
<p>
<h4><a name="MXBean">Platform MXBean</a></h4>
<p>
A platform MXBean is a <i>managed bean</i> that
conforms to the <a href="../../../javax/management/package-summary.html">JMX</a>
Instrumentation Specification and only uses a set of basic data types.
Each platform MXBean is a {@link java.lang.management.PlatformManagedObject}
with a unique
{@linkplain java.lang.management.PlatformManagedObject#getObjectName name}.
<p>
<h4>ManagementFactory</h4>
<p>The {@link java.lang.management.ManagementFactory} class is the management
factory class for the Java platform. This class provides a set of
static factory methods to obtain the MXBeans for the Java platform
to allow an application to access the MXBeans directly.
<p>A <em>platform MBeanServer</em> can be accessed with the
{@link java.lang.management.ManagementFactory#getPlatformMBeanServer
getPlatformMBeanServer} method. On the first call to this method,
it creates the platform MBeanServer and registers all platform MXBeans
including {@linkplain java.lang.management.PlatformManagedObject
platform MXBeans}.
Each platform MXBean is registered with a unique name defined in
the specification of the management interface.
This is a single MBeanServer that can be shared by different managed
components running within the same Java virtual machine.
<h4>Interoperability</h4>
<p>A management application and a platform MBeanServer of a running
virtual machine can interoperate
without requiring classes used by the platform MXBean interfaces.
The data types being transmitted between the JMX connector
server and the connector client are JMX
{@linkplain javax.management.openmbean.OpenType open types} and
this allows interoperation across versions.
A data type used by the MXBean interfaces are mapped to an
open type when being accessed via MBeanServer interface.
See the <a href="../../../javax/management/MXBean.html#MXBean-spec">
MXBean</a> specification for details.
<h4><a name="examples">Ways to Access MXBeans</a></h4>
<p>An application can monitor the instrumentation of the
Java virtual machine and the runtime in the following ways:
<p>
<b>1. Direct access to an MXBean interface</b>
<p>
<ul>
<li>Get an MXBean instance locally in the running Java virtual machine:
<pre>
RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean();
// Get the standard attribute "VmVendor"
String vendor = mxbean.getVmVendor();
</pre>
<p>Or by calling the
{@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
getPlatformMXBean} or
{@link java.lang.management.ManagementFactory#getPlatformMXBeans(Class)
getPlatformMXBeans} method:
<pre>
RuntimeMXBean mxbean = ManagementFactory.getPlatformMXBean(RuntimeMXBean.class);
// Get the standard attribute "VmVendor"
String vendor = mxbean.getVmVendor();
</pre>
<p>
</li>
<li>Construct an MXBean proxy instance that forwards the
method calls to a given MBeanServer:
<pre>
MBeanServerConnection mbs;
// Connect to a running JVM (or itself) and get MBeanServerConnection
// that has the JVM MBeans registered in it
...
// Get a MBean proxy for RuntimeMXBean interface
RuntimeMXBean proxy =
{@link java.lang.management.ManagementFactory#getPlatformMXBean(MBeanServerConnection, Class)
ManagementFactory.getPlatformMXBean}(mbs,
RuntimeMXBean.class);
// Get standard attribute "VmVendor"
String vendor = proxy.getVmVendor();
</pre>
<p>A proxy is typically used to access an MXBean
in a remote Java virtual machine.
An alternative way to create an MXBean proxy is:
<pre>
RuntimeMXBean proxy =
{@link java.lang.management.ManagementFactory#newPlatformMXBeanProxy
ManagementFactory.newPlatformMXBeanProxy}(mbs,
ManagementFactory.RUNTIME_MXBEAN_NAME,
RuntimeMXBean.class);
</pre>
</li>
</ul>
<p>
<b>2. Indirect access to an MXBean interface via MBeanServer</b><p>
<ul>
<li>Go through the
{@link java.lang.management.ManagementFactory#getPlatformMBeanServer
platform MBeanServer} to access MXBeans locally or
a specific {@code MBeanServerConnection} to access
MXBeans remotely.
The attributes and operations of an MXBean use only
<em>JMX open types</em> which include basic data types,
{@link javax.management.openmbean.CompositeData CompositeData},
and {@link javax.management.openmbean.TabularData TabularData}
defined in {@link javax.management.openmbean.OpenType OpenType}.<p>
<pre>
MBeanServerConnection mbs;
// Connect to a running JVM (or itself) and get MBeanServerConnection
// that has the JVM MXBeans registered in it
...
try {
// Assuming the RuntimeMXBean has been registered in mbs
ObjectName oname = new ObjectName(ManagementFactory.RUNTIME_MXBEAN_NAME);
// Get standard attribute "VmVendor"
String vendor = (String) mbs.getAttribute(oname, "VmVendor");
} catch (....) {
// Catch the exceptions thrown by ObjectName constructor
// and MBeanServer.getAttribute method
...
}
</pre>
</li>
</ul>
<h4><a name="extension">Platform Extension</a></h4>
<p>A Java virtual machine implementation may add its platform extension to
the management interface by defining platform-dependent
interfaces that extend the standard management interfaces to include
platform-specific metrics and management operations.
The static factory methods in the <tt>ManagementFactory</tt> class will
return the MXBeans with the platform extension.
<p>
It is recommended to name the platform-specific attributes with
a vendor-specific prefix such as the vendor's name to
avoid collisions of the attribute name between the future extension
to the standard management interface and the platform extension.
If the future extension to the standard management interface defines
a new attribute for a management interface and the attribute name
is happened to be same as some vendor-specific attribute's name,
the applications accessing that vendor-specific attribute would have
to be modified to cope with versioning and compatibility issues.
<p>Below is an example showing how to access an attribute
from the platform extension:
<p>
1) Direct access to the Oracle-specific MXBean interface
<blockquote>
<pre>
List&lt;com.sun.management.GarbageCollectorMXBean&gt; mxbeans =
ManagementFactory.getPlatformMXBeans(com.sun.management.GarbageCollectorMXBean.class);
for (com.sun.management.GarbageCollectorMXBean gc : mxbeans) {
// Get the standard attribute "CollectionCount"
String count = mxbean.getCollectionCount();
// Get the platform-specific attribute "LastGcInfo"
GcInfo gcinfo = gc.getLastGcInfo();
...
}
</pre>
</blockquote>
<p>
2) Access the Oracle-specific MXBean interface via <tt>MBeanServer</tt>
through proxy
<blockquote><pre>
MBeanServerConnection mbs;
// Connect to a running JVM (or itself) and get MBeanServerConnection
// that has the JVM MXBeans registered in it
...
List&lt;com.sun.management.GarbageCollectorMXBean&gt; mxbeans =
ManagementFactory.getPlatformMXBeans(mbs, com.sun.management.GarbageCollectorMXBean.class);
for (com.sun.management.GarbageCollectorMXBean gc : mxbeans) {
// Get the standard attribute "CollectionCount"
String count = mxbean.getCollectionCount();
// Get the platform-specific attribute "LastGcInfo"
GcInfo gcinfo = gc.getLastGcInfo();
...
}
</pre></blockquote>
<p> Unless otherwise noted, passing a <tt>null</tt> argument to a constructor
or method in any class or interface in this package will cause a {@link
java.lang.NullPointerException NullPointerException} to be thrown.
<p> The java.lang.management API is thread-safe.
@see <a href="../../../javax/management/package-summary.html">
JMX Specification.</a>
@author Mandy Chung
@since 1.5
</body>
</html>
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册