📄 swingutilities.html
字号:
<A HREF="../../java/awt/Component.html">Component</A> c)</PRE><DL><DD>Convert a point from a screen coordinates to a component's coordinate system<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>p</CODE> - a Point object (converted to the new coordinate system)<DD><CODE>c</CODE> - a Component object</DL></DD></DL><HR><A NAME="windowForComponent(java.awt.Component)"><!-- --></A><H3>windowForComponent</H3><PRE>public static <A HREF="../../java/awt/Window.html">Window</A> <B>windowForComponent</B>(<A HREF="../../java/awt/Component.html">Component</A> aComponent)</PRE><DL><DD>Return <code>aComponent</code>'s window<DD><DL></DL></DD></DL><HR><A NAME="isDescendingFrom(java.awt.Component, java.awt.Component)"><!-- --></A><H3>isDescendingFrom</H3><PRE>public static boolean <B>isDescendingFrom</B>(<A HREF="../../java/awt/Component.html">Component</A> a, <A HREF="../../java/awt/Component.html">Component</A> b)</PRE><DL><DD>Return <code>true</code> if a component <code>a</code> descends from a component <code>b</code><DD><DL></DL></DD></DL><HR><A NAME="computeIntersection(int, int, int, int, java.awt.Rectangle)"><!-- --></A><H3>computeIntersection</H3><PRE>public static <A HREF="../../java/awt/Rectangle.html">Rectangle</A> <B>computeIntersection</B>(int x, int y, int width, int height, <A HREF="../../java/awt/Rectangle.html">Rectangle</A> dest)</PRE><DL><DD>Convenience to calculate the intersection of two rectangles without allocating a new rectangle. If the two rectangles don't intersect, then the returned rectangle begins at (0,0) and has zero width and height.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>x</CODE> - the X coordinate of the first rectangle's top-left point<DD><CODE>y</CODE> - the Y coordinate of the first rectangle's top-left point<DD><CODE>width</CODE> - the width of the first rectangle<DD><CODE>height</CODE> - the height of the first rectangle<DD><CODE>dest</CODE> - the second rectangle<DT><B>Returns:</B><DD><code>dest</code>, modified to specify the intersection</DL></DD></DL><HR><A NAME="computeUnion(int, int, int, int, java.awt.Rectangle)"><!-- --></A><H3>computeUnion</H3><PRE>public static <A HREF="../../java/awt/Rectangle.html">Rectangle</A> <B>computeUnion</B>(int x, int y, int width, int height, <A HREF="../../java/awt/Rectangle.html">Rectangle</A> dest)</PRE><DL><DD>Convenience to calculate the union of two rectangles without allocating a new rectangle Return dest<DD><DL></DL></DD></DL><HR><A NAME="computeDifference(java.awt.Rectangle, java.awt.Rectangle)"><!-- --></A><H3>computeDifference</H3><PRE>public static <A HREF="../../java/awt/Rectangle.html">Rectangle</A>[] <B>computeDifference</B>(<A HREF="../../java/awt/Rectangle.html">Rectangle</A> rectA, <A HREF="../../java/awt/Rectangle.html">Rectangle</A> rectB)</PRE><DL><DD>Convenience returning an array of rect representing the regions within <code>rectA</code> that do not overlap with <code>rectB</code>. If the two Rects do not overlap, returns an empty array<DD><DL></DL></DD></DL><HR><A NAME="isLeftMouseButton(java.awt.event.MouseEvent)"><!-- --></A><H3>isLeftMouseButton</H3><PRE>public static boolean <B>isLeftMouseButton</B>(<A HREF="../../java/awt/event/MouseEvent.html">MouseEvent</A> anEvent)</PRE><DL><DD>Returns true if the mouse event specifies the left mouse button.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>anEvent</CODE> - a MouseEvent object<DT><B>Returns:</B><DD>true if the left mouse button was active</DL></DD></DL><HR><A NAME="isMiddleMouseButton(java.awt.event.MouseEvent)"><!-- --></A><H3>isMiddleMouseButton</H3><PRE>public static boolean <B>isMiddleMouseButton</B>(<A HREF="../../java/awt/event/MouseEvent.html">MouseEvent</A> anEvent)</PRE><DL><DD>Returns true if the mouse event specifies the middle mouse button.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>anEvent</CODE> - a MouseEvent object<DT><B>Returns:</B><DD>true if the middle mouse button was active</DL></DD></DL><HR><A NAME="isRightMouseButton(java.awt.event.MouseEvent)"><!-- --></A><H3>isRightMouseButton</H3><PRE>public static boolean <B>isRightMouseButton</B>(<A HREF="../../java/awt/event/MouseEvent.html">MouseEvent</A> anEvent)</PRE><DL><DD>Returns true if the mouse event specifies the right mouse button.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>anEvent</CODE> - a MouseEvent object<DT><B>Returns:</B><DD>true if the right mouse button was active</DL></DD></DL><HR><A NAME="computeStringWidth(java.awt.FontMetrics, java.lang.String)"><!-- --></A><H3>computeStringWidth</H3><PRE>public static int <B>computeStringWidth</B>(<A HREF="../../java/awt/FontMetrics.html">FontMetrics</A> fm, <A HREF="../../java/lang/String.html">String</A> str)</PRE><DL><DD>Compute the width of the string using a font with the specified "metrics" (sizes).<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>fm</CODE> - a FontMetrics object to compute with<DD><CODE>str</CODE> - the String to compute<DT><B>Returns:</B><DD>an int containing the string width</DL></DD></DL><HR><A NAME="layoutCompoundLabel(javax.swing.JComponent, java.awt.FontMetrics, java.lang.String, javax.swing.Icon, int, int, int, int, java.awt.Rectangle, java.awt.Rectangle, java.awt.Rectangle, int)"><!-- --></A><H3>layoutCompoundLabel</H3><PRE>public static <A HREF="../../java/lang/String.html">String</A> <B>layoutCompoundLabel</B>(<A HREF="../../javax/swing/JComponent.html">JComponent</A> c, <A HREF="../../java/awt/FontMetrics.html">FontMetrics</A> fm, <A HREF="../../java/lang/String.html">String</A> text, <A HREF="../../javax/swing/Icon.html">Icon</A> icon, int verticalAlignment, int horizontalAlignment, int verticalTextPosition, int horizontalTextPosition, <A HREF="../../java/awt/Rectangle.html">Rectangle</A> viewR, <A HREF="../../java/awt/Rectangle.html">Rectangle</A> iconR, <A HREF="../../java/awt/Rectangle.html">Rectangle</A> textR, int textIconGap)</PRE><DL><DD>Compute and return the location of the icons origin, the location of origin of the text baseline, and a possibly clipped version of the compound labels string. Locations are computed relative to the viewR rectangle. The JComponents orientation (LEADING/TRAILING) will also be taken into account and translated into LEFT/RIGHT values accordingly.<DD><DL></DL></DD></DL><HR><A NAME="layoutCompoundLabel(java.awt.FontMetrics, java.lang.String, javax.swing.Icon, int, int, int, int, java.awt.Rectangle, java.awt.Rectangle, java.awt.Rectangle, int)"><!-- --></A><H3>layoutCompoundLabel</H3><PRE>public static <A HREF="../../java/lang/String.html">String</A> <B>layoutCompoundLabel</B>(<A HREF="../../java/awt/FontMetrics.html">FontMetrics</A> fm, <A HREF="../../java/lang/String.html">String</A> text, <A HREF="../../javax/swing/Icon.html">Icon</A> icon, int verticalAlignment, int horizontalAlignment, int verticalTextPosition, int horizontalTextPosition, <A HREF="../../java/awt/Rectangle.html">Rectangle</A> viewR, <A HREF="../../java/awt/Rectangle.html">Rectangle</A> iconR, <A HREF="../../java/awt/Rectangle.html">Rectangle</A> textR, int textIconGap)</PRE><DL><DD>Compute and return the location of the icons origin, the location of origin of the text baseline, and a possibly clipped version of the compound labels string. Locations are computed relative to the viewR rectangle. This layoutCompoundLabel() does not know how to handle LEADING/TRAILING values in horizontalTextPosition (they will default to RIGHT) and in horizontalAlignment (they will default to CENTER). Use the other version of layoutCompoundLabel() instead.<DD><DL></DL></DD></DL><HR><A NAME="paintComponent(java.awt.Graphics, java.awt.Component, java.awt.Container, int, int, int, int)"><!-- --></A><H3>paintComponent</H3><PRE>public static void <B>paintComponent</B>(<A HREF="../../java/awt/Graphics.html">Graphics</A> g, <A HREF="../../java/awt/Component.html">Component</A> c, <A HREF="../../java/awt/Container.html">Container</A> p, int x, int y, int w, int h)</PRE><DL><DD>Paint a component c on an abitrary graphics g in the specified rectangle, specifying the rectangle's upper left corner and size. The component is reparented to a private container (whose parent becomes p) which prevents c.validate() and and c.repaint() calls from propogating up the tree. The intermediate container has no other effect.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>g</CODE> - the Graphics object to draw on<DD><CODE>c</CODE> - the Component to draw<DD><CODE>p</CODE> - the intermedate Container<DD><CODE>x</CODE> - an int specifying the left side of the area draw in, in pixels, measured from the left edge of the graphics context<DD><CODE>y</CODE> - an int specifying the top of the area to draw in, in pixels measured down from the top edge of the graphics context<DD><CODE>w</CODE> - an int specifying the width of the area draw in, in pixels<DD><CODE>h</CODE> - an int specifying the height of the area draw in, in pixels</DL></DD></DL><HR><A NAME="paintComponent(java.awt.Graphics, java.awt.Component, java.awt.Container, java.awt.Rectangle)"><!-- --></A><H3>paintComponent</H3><PRE>public static void <B>paintComponent</B>(<A HREF="../../java/awt/Graphics.html">Graphics</A> g, <A HREF="../../java/awt/Component.html">Component</A> c, <A HREF="../../java/awt/Container.html">Container</A> p, <A HREF="../../java/awt/Rectangle.html">Rectangle</A> r)</PRE><DL><DD>Paint a component c on an abitrary graphics g in the specified rectangle, specifying a Rectangle object. The component is reparented to a private container (whose parent becomes p) which prevents c.validate() and and c.repaint() calls from propogating up the tree. The intermediate container has no other effect.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>g</CODE> - the Graphics object to draw on<DD><CODE>c</CODE> - the Component to draw<DD><CODE>p</CODE> - the intermedate Container<DD><CODE>r</CODE> - the Rectangle to draw in</DL></DD></DL><HR><A NAME="updateComponentTreeUI(java.awt.Component)"><!-- --></A><H3>updateComponentTreeUI</H3><PRE>public static void <B>updateComponentTreeUI</B>(<A HREF="../../java/awt/Component.html">Component</A> c)</PRE><DL>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -