⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 swingutilities.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<DD>A simple minded look and feel change: ask each node in the tree to updateUI() -- that is, to initialize its UI property with the current look and feel.<DD><DL></DL></DD></DL><HR><A NAME="invokeLater(java.lang.Runnable)"><!-- --></A><H3>invokeLater</H3><PRE>public static void <B>invokeLater</B>(<A HREF="../../java/lang/Runnable.html">Runnable</A>&nbsp;doRun)</PRE><DL><DD>Causes <i>doRun.run()</i> to be executed asynchronously on the AWT event dispatching thread.  This will happen after all pending AWT events have been processed.  This method should be used when an application thread needs to update the GUI. In the following example the <code>invokeLater</code> call queues the <code>Runnable</code> object <code>doHelloWorld</code> on the event dispatching thread and then prints a message. <pre> Runnable doHelloWorld = new Runnable() {     public void run() {         System.out.println("Hello World on " + Thread.currentThread());     } }; SwingUtilities.invokeLater(doHelloWorld); System.out.println("This might well be displayed before the other message."); </pre> If invokeLater is called from the event dispatching thread -- for example, from a JButton's ActionListener -- the <i>doRun.run()</i> will still be deferred until all pending events have been processed. Note that if the <i>doRun.run()</i> throws an uncaught exception the event dispatching thread will unwind (not the current thread). <p> Additional documentation and examples for this method can be found in <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How to Use Threads</a>, in <em>The Java Tutorial</em>. <p> As of 1.3 this method is just a cover for <code>java.awt.EventQueue.invokeLater()</code>.<DD><DL></DL></DD><DD><DL><DT><B>See Also: </B><DD><A HREF="../../javax/swing/SwingUtilities.html#invokeAndWait(java.lang.Runnable)"><CODE>invokeAndWait(java.lang.Runnable)</CODE></A></DL></DD></DL><HR><A NAME="invokeAndWait(java.lang.Runnable)"><!-- --></A><H3>invokeAndWait</H3><PRE>public static void <B>invokeAndWait</B>(<A HREF="../../java/lang/Runnable.html">Runnable</A>&nbsp;doRun)                          throws <A HREF="../../java/lang/InterruptedException.html">InterruptedException</A>,                                 <A HREF="../../java/lang/reflect/InvocationTargetException.html">InvocationTargetException</A></PRE><DL><DD>Causes <i>doRun.run()</i> to be executed synchronously on the AWT event dispatching thread.  This call will block until all pending AWT events have been processed and (then) <i>doRun.run()</i> returns. This method should be used when an application thread needs to update the GUI. It should not be called from the EventDispatchThread. Here's an example that creates a new application thread that uses invokeAndWait() to print a string from the event dispatching thread and then, when that's finished, print a string from the application thread. <pre> final Runnable doHelloWorld = new Runnable() {     public void run() {         System.out.println("Hello World on " + Thread.currentThread());     } }; Thread appThread = new Thread() {     public void run() {         try {             SwingUtilities.invokeAndWait(doHelloWorld);         }         catch (Exception e) {             e.printStackTrace();         }         System.out.println("Finished on " + Thread.currentThread());     } }; appThread.start(); </pre> Note that if the Runnable.run() method throws an uncaught exception (on the event dispatching thread) it's caught and rethrown, as an InvocationTargetException, on the callers thread. <p> Additional documentation and examples for this method can be found in <A HREF="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html">How to Use Threads</a>, in <em>The Java Tutorial</em>. <p> As of 1.3 this method is just a cover for <code>java.awt.EventQueue.invokeAndWait()</code>.<DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/InterruptedException.html">InterruptedException</A></CODE> - if we're interrupted while waiting for             the event dispatching thread to finish excecuting <i>doRun.run()</i><DD><CODE><A HREF="../../java/lang/reflect/InvocationTargetException.html">InvocationTargetException</A></CODE> - if <i>doRun.run()</i> throws<DT><B>See Also: </B><DD><A HREF="../../javax/swing/SwingUtilities.html#invokeLater(java.lang.Runnable)"><CODE>invokeLater(java.lang.Runnable)</CODE></A></DL></DD></DL><HR><A NAME="isEventDispatchThread()"><!-- --></A><H3>isEventDispatchThread</H3><PRE>public static boolean <B>isEventDispatchThread</B>()</PRE><DL><DD>Returns true if the current thread is an AWT event dispatching thread. <p> As of 1.3 this method is just a cover for  <code>java.awt.EventQueue.isEventDispatchThread()</code>.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>true if the current thread is an AWT event dispatching thread</DL></DD></DL><HR><A NAME="getAccessibleIndexInParent(java.awt.Component)"><!-- --></A><H3>getAccessibleIndexInParent</H3><PRE>public static int <B>getAccessibleIndexInParent</B>(<A HREF="../../java/awt/Component.html">Component</A>&nbsp;c)</PRE><DL><DD>Get the index of this object in its accessible parent.<p> Note: as of the Java 2 platform v1.3, it is recommended that developers call Component.AccessibleAWTComponent.getAccessibleIndexInParent() instead of using this method.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>-1 of this object does not have an accessible parent. Otherwise, the index of the child in its accessible parent.</DL></DD></DL><HR><A NAME="getAccessibleAt(java.awt.Component, java.awt.Point)"><!-- --></A><H3>getAccessibleAt</H3><PRE>public static <A HREF="../../javax/accessibility/Accessible.html">Accessible</A> <B>getAccessibleAt</B>(<A HREF="../../java/awt/Component.html">Component</A>&nbsp;c,                                         <A HREF="../../java/awt/Point.html">Point</A>&nbsp;p)</PRE><DL><DD>Returns the Accessible child contained at the local coordinate Point, if one exists.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the Accessible at the specified location, if it exists</DL></DD></DL><HR><A NAME="getAccessibleStateSet(java.awt.Component)"><!-- --></A><H3>getAccessibleStateSet</H3><PRE>public static <A HREF="../../javax/accessibility/AccessibleStateSet.html">AccessibleStateSet</A> <B>getAccessibleStateSet</B>(<A HREF="../../java/awt/Component.html">Component</A>&nbsp;c)</PRE><DL><DD>Get the state of this object. <p> Note: as of the Java 2 platform v1.3, it is recommended that developers call Component.AccessibleAWTComponent.getAccessibleIndexInParent() instead of using this method.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>an instance of AccessibleStateSet containing the current state set of the object<DT><B>See Also: </B><DD><A HREF="../../javax/accessibility/AccessibleState.html"><CODE>AccessibleState</CODE></A></DL></DD></DL><HR><A NAME="getAccessibleChildrenCount(java.awt.Component)"><!-- --></A><H3>getAccessibleChildrenCount</H3><PRE>public static int <B>getAccessibleChildrenCount</B>(<A HREF="../../java/awt/Component.html">Component</A>&nbsp;c)</PRE><DL><DD>Returns the number of accessible children in the object.  If all of the children of this object implement Accessible, than this method should return the number of children of this object. <p> Note: as of the Java 2 platform v1.3, it is recommended that developers call Component.AccessibleAWTComponent.getAccessibleIndexInParent() instead of using this method.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the number of accessible children in the object.</DL></DD></DL><HR><A NAME="getAccessibleChild(java.awt.Component, int)"><!-- --></A><H3>getAccessibleChild</H3><PRE>public static <A HREF="../../javax/accessibility/Accessible.html">Accessible</A> <B>getAccessibleChild</B>(<A HREF="../../java/awt/Component.html">Component</A>&nbsp;c,                                            int&nbsp;i)</PRE><DL><DD>Return the nth Accessible child of the object. <p> Note: as of the Java 2 platform v1.3, it is recommended that developers call Component.AccessibleAWTComponent.getAccessibleIndexInParent() instead of using this method.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>i</CODE> - zero-based index of child<DT><B>Returns:</B><DD>the nth Accessible child of the object</DL></DD></DL><HR><A NAME="findFocusOwner(java.awt.Component)"><!-- --></A><H3>findFocusOwner</H3><PRE>public static <A HREF="../../java/awt/Component.html">Component</A> <B>findFocusOwner</B>(<A HREF="../../java/awt/Component.html">Component</A>&nbsp;c)</PRE><DL><DD>Return the child component which has focus, if any.  The HotJava SecurityManager forbids applet access to getFocusOwner(), so if the component is an applet, we check whether a JComponent has focus. Non-Swing components in an applet on HotJava are out-of-luck, unfortunately.<DD><DL></DL></DD></DL><HR><A NAME="getRootPane(java.awt.Component)"><!-- --></A><H3>getRootPane</H3><PRE>public static <A HREF="../../javax/swing/JRootPane.html">JRootPane</A> <B>getRootPane</B>(<A HREF="../../java/awt/Component.html">Component</A>&nbsp;c)</PRE><DL><DD>If c is a JRootPane descendant return its JRootPane ancestor. If c is a RootPaneContainer then return its JRootPane.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the JRootPane for Component c or null.</DL></DD></DL><HR><A NAME="getRoot(java.awt.Component)"><!-- --></A><H3>getRoot</H3><PRE>public static <A HREF="../../java/awt/Com

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -