📄 swingutilities.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:39:53 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class SwingUtilities</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/SwingUtilities.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../javax/swing/SizeSequence.html"><B>PREV CLASS</B></A> <A HREF="../../javax/swing/Timer.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="SwingUtilities.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.swing</FONT><BR>Class SwingUtilities</H2><PRE><A HREF="../../java/lang/Object.html">java.lang.Object</A> | +--<B>javax.swing.SwingUtilities</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../javax/swing/SwingConstants.html">SwingConstants</A></DD></DL><HR><DL><DT>public class <B>SwingUtilities</B><DT>extends <A HREF="../../java/lang/Object.html">Object</A><DT>implements <A HREF="../../javax/swing/SwingConstants.html">SwingConstants</A></DL><P>A collection of utility methods for Swing.<P><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="fields_inherited_from_class_javax.swing.SwingConstants"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Fields inherited from interface javax.swing.<A HREF="../../javax/swing/SwingConstants.html">SwingConstants</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../javax/swing/SwingConstants.html#BOTTOM">BOTTOM</A>, <A HREF="../../javax/swing/SwingConstants.html#CENTER">CENTER</A>, <A HREF="../../javax/swing/SwingConstants.html#EAST">EAST</A>, <A HREF="../../javax/swing/SwingConstants.html#HORIZONTAL">HORIZONTAL</A>, <A HREF="../../javax/swing/SwingConstants.html#LEADING">LEADING</A>, <A HREF="../../javax/swing/SwingConstants.html#LEFT">LEFT</A>, <A HREF="../../javax/swing/SwingConstants.html#NORTH">NORTH</A>, <A HREF="../../javax/swing/SwingConstants.html#NORTH_EAST">NORTH_EAST</A>, <A HREF="../../javax/swing/SwingConstants.html#NORTH_WEST">NORTH_WEST</A>, <A HREF="../../javax/swing/SwingConstants.html#RIGHT">RIGHT</A>, <A HREF="../../javax/swing/SwingConstants.html#SOUTH">SOUTH</A>, <A HREF="../../javax/swing/SwingConstants.html#SOUTH_EAST">SOUTH_EAST</A>, <A HREF="../../javax/swing/SwingConstants.html#SOUTH_WEST">SOUTH_WEST</A>, <A HREF="../../javax/swing/SwingConstants.html#TOP">TOP</A>, <A HREF="../../javax/swing/SwingConstants.html#TRAILING">TRAILING</A>, <A HREF="../../javax/swing/SwingConstants.html#VERTICAL">VERTICAL</A>, <A HREF="../../javax/swing/SwingConstants.html#WEST">WEST</A></CODE></TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/awt/Rectangle.html">Rectangle</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/SwingUtilities.html#computeDifference(java.awt.Rectangle, java.awt.Rectangle)">computeDifference</A></B>(<A HREF="../../java/awt/Rectangle.html">Rectangle</A> rectA, <A HREF="../../java/awt/Rectangle.html">Rectangle</A> rectB)</CODE><BR> Convenience returning an array of rect representing the regions within <code>rectA</code> that do not overlap with <code>rectB</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/awt/Rectangle.html">Rectangle</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/SwingUtilities.html#computeIntersection(int, int, int, int, java.awt.Rectangle)">computeIntersection</A></B>(int x, int y, int width, int height, <A HREF="../../java/awt/Rectangle.html">Rectangle</A> dest)</CODE><BR> Convenience to calculate the intersection of two rectangles without allocating a new rectangle.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/SwingUtilities.html#computeStringWidth(java.awt.FontMetrics, java.lang.String)">computeStringWidth</A></B>(<A HREF="../../java/awt/FontMetrics.html">FontMetrics</A> fm, <A HREF="../../java/lang/String.html">String</A> str)</CODE><BR> Compute the width of the string using a font with the specified "metrics" (sizes).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/awt/Rectangle.html">Rectangle</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/SwingUtilities.html#computeUnion(int, int, int, int, java.awt.Rectangle)">computeUnion</A></B>(int x, int y, int width, int height, <A HREF="../../java/awt/Rectangle.html">Rectangle</A> dest)</CODE><BR> Convenience to calculate the union of two rectangles without allocating a new rectangle Return dest</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/awt/event/MouseEvent.html">MouseEvent</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/SwingUtilities.html#convertMouseEvent(java.awt.Component, java.awt.event.MouseEvent, java.awt.Component)">convertMouseEvent</A></B>(<A HREF="../../java/awt/Component.html">Component</A> source, <A HREF="../../java/awt/event/MouseEvent.html">MouseEvent</A> sourceEvent, <A HREF="../../java/awt/Component.html">Component</A> destination)</CODE><BR> Returns a MouseEvent similar to <code>sourceEvent</code> except that its x and y members have been converted to <code>destination</code>'s coordinate system.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/awt/Point.html">Point</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/SwingUtilities.html#convertPoint(java.awt.Component, int, int, java.awt.Component)">convertPoint</A></B>(<A HREF="../../java/awt/Component.html">Component</A> source, int x, int y, <A HREF="../../java/awt/Component.html">Component</A> destination)</CODE><BR> Convert the point <code>(x,y)</code> in <code>source</code> coordinate system to <code>destination</code> coordinate system.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/awt/Point.html">Point</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/SwingUtilities.html#convertPoint(java.awt.Component, java.awt.Point, java.awt.Component)">convertPoint</A></B>(<A HREF="../../java/awt/Component.html">Component</A> source, <A HREF="../../java/awt/Point.html">Point</A> aPoint, <A HREF="../../java/awt/Component.html">Component</A> destination)</CODE><BR> Convert a <code>aPoint</code> in <code>source</code> coordinate system to <code>destination</code> coordinate system.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/SwingUtilities.html#convertPointFromScreen(java.awt.Point, java.awt.Component)">convertPointFromScreen</A></B>(<A HREF="../../java/awt/Point.html">Point</A> p, <A HREF="../../java/awt/Component.html">Component</A> c)</CODE><BR> Convert a point from a screen coordinates to a component's coordinate system</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/SwingUtilities.html#convertPointToScreen(java.awt.Point, java.awt.Component)">convertPointToScreen</A></B>(<A HREF="../../java/awt/Point.html">Point</A> p, <A HREF="../../java/awt/Component.html">Component</A> c)</CODE><BR> Convert a point from a component's coordinate system to screen coordinates.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/awt/Rectangle.html">Rectangle</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/SwingUtilities.html#convertRectangle(java.awt.Component, java.awt.Rectangle, java.awt.Component)">convertRectangle</A></B>(<A HREF="../../java/awt/Component.html">Component</A> source, <A HREF="../../java/awt/Rectangle.html">Rectangle</A> aRectangle, <A HREF="../../java/awt/Component.html">Component</A> destination)</CODE><BR> Convert the rectangle <code>aRectangle</code> in <code>source</code> coordinate system to <code>destination</code> coordinate system.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/awt/Component.html">Component</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/SwingUtilities.html#findFocusOwner(java.awt.Component)">findFocusOwner</A></B>(<A HREF="../../java/awt/Component.html">Component</A> c)</CODE><BR> Return the child component which has focus, if any.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../javax/accessibility/Accessible.html">Accessible</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/SwingUtilities.html#getAccessibleAt(java.awt.Component, java.awt.Point)">getAccessibleAt</A></B>(<A HREF="../../java/awt/Component.html">Component</A> c, <A HREF="../../java/awt/Point.html">Point</A> p)</CODE><BR> Returns the Accessible child contained at the local coordinate Point, if one exists.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../javax/accessibility/Accessible.html">Accessible</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/SwingUtilities.html#getAccessibleChild(java.awt.Component, int)">getAccessibleChild</A></B>(<A HREF="../../java/awt/Component.html">Component</A> c, int i)</CODE><BR> Return the nth Accessible child of the object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/SwingUtilities.html#getAccessibleChildrenCount(java.awt.Component)">getAccessibleChildrenCount</A></B>(<A HREF="../../java/awt/Component.html">Component</A> c)</CODE><BR> Returns the number of accessible children in the object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -