< prev index next >

src/java.desktop/share/classes/sun/awt/SunToolkit.java

Print this page




 349      /**
 350       * Sets the synchronous status of focus requests on lightweight
 351       * components in the specified window to the specified value.
 352       * If the boolean parameter is <code>true</code> then the focus
 353       * requests on lightweight components will be performed
 354       * synchronously, if it is <code>false</code>, then asynchronously.
 355       * By default, all windows have their lightweight request status
 356       * set to asynchronous.
 357       * <p>
 358       * The application can only set the status of lightweight focus
 359       * requests to synchronous for any of its windows if it doesn't
 360       * perform focus transfers between different heavyweight containers.
 361       * In this case the observable focus behaviour is the same as with
 362       * asynchronous status.
 363       * <p>
 364       * If the application performs focus transfer between different
 365       * heavyweight containers and sets the lightweight focus request
 366       * status to synchronous for any of its windows, then further focus
 367       * behaviour is unspecified.
 368       * <p>
 369       * @param    w window for which the lightweight focus request status
 370       *             should be set
 371       * @param    status the value of lightweight focus request status
 372       */
 373 
 374     public static void setLWRequestStatus(Window changed,boolean status){
 375         AWTAccessor.getWindowAccessor().setLWRequestStatus(changed, status);
 376     };
 377 
 378     public static void checkAndSetPolicy(Container cont) {
 379         FocusTraversalPolicy defaultPolicy = KeyboardFocusManager.
 380             getCurrentKeyboardFocusManager().
 381                 getDefaultFocusTraversalPolicy();
 382 
 383         cont.setFocusTraversalPolicy(defaultPolicy);
 384     }
 385 
 386     private static FocusTraversalPolicy createLayoutPolicy() {
 387         FocusTraversalPolicy policy = null;
 388         try {
 389             Class<?> layoutPolicyClass =


1442      * Frame f = ...;
1443      * f.setVisible(true);
1444      * ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
1445      * </code>
1446      *
1447      * <p> After realSync, <code>f</code> will be completely visible
1448      * on the screen, its getLocationOnScreen will be returning the
1449      * right result and it will be the focus owner.
1450      *
1451      * <p> Another example:
1452      * <code>
1453      * b.requestFocus();
1454      * ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
1455      * </code>
1456      *
1457      * <p> After realSync, <code>b</code> will be focus owner.
1458      *
1459      * <p> Notice that realSync isn't guaranteed to work if recurring
1460      * actions occur, such as if during processing of some event
1461      * another request which may generate some events occurs.  By
1462      * default, sync tries to perform as much as {@value MAX_ITERS}
1463      * cycles of event processing, allowing for roughly {@value
1464      * MAX_ITERS} additional requests.
1465      *
1466      * <p> For example, requestFocus() generates native request, which
1467      * generates one or two Java focus events, which then generate a
1468      * serie of paint events, a serie of Java focus events, which then
1469      * generate a serie of paint events which then are processed -
1470      * three cycles, minimum.
1471      *
1472      * @param timeout the maximum time to wait in milliseconds, negative means "forever".
1473      */
1474     public void realSync(final long timeout) throws OperationTimedOut, InfiniteLoop
1475     {
1476         if (EventQueue.isDispatchThread()) {
1477             throw new IllegalThreadException("The SunToolkit.realSync() method cannot be used on the event dispatch thread (EDT).");
1478         }
1479         int bigLoop = 0;
1480         do {
1481             // Let's do sync first
1482             sync();
1483 
1484             // During the wait process, when we were processing incoming




 349      /**
 350       * Sets the synchronous status of focus requests on lightweight
 351       * components in the specified window to the specified value.
 352       * If the boolean parameter is <code>true</code> then the focus
 353       * requests on lightweight components will be performed
 354       * synchronously, if it is <code>false</code>, then asynchronously.
 355       * By default, all windows have their lightweight request status
 356       * set to asynchronous.
 357       * <p>
 358       * The application can only set the status of lightweight focus
 359       * requests to synchronous for any of its windows if it doesn't
 360       * perform focus transfers between different heavyweight containers.
 361       * In this case the observable focus behaviour is the same as with
 362       * asynchronous status.
 363       * <p>
 364       * If the application performs focus transfer between different
 365       * heavyweight containers and sets the lightweight focus request
 366       * status to synchronous for any of its windows, then further focus
 367       * behaviour is unspecified.
 368       * <p>
 369       * @param    changed window for which the lightweight focus request status
 370       *             should be set
 371       * @param    status the value of lightweight focus request status
 372       */
 373 
 374     public static void setLWRequestStatus(Window changed,boolean status){
 375         AWTAccessor.getWindowAccessor().setLWRequestStatus(changed, status);
 376     };
 377 
 378     public static void checkAndSetPolicy(Container cont) {
 379         FocusTraversalPolicy defaultPolicy = KeyboardFocusManager.
 380             getCurrentKeyboardFocusManager().
 381                 getDefaultFocusTraversalPolicy();
 382 
 383         cont.setFocusTraversalPolicy(defaultPolicy);
 384     }
 385 
 386     private static FocusTraversalPolicy createLayoutPolicy() {
 387         FocusTraversalPolicy policy = null;
 388         try {
 389             Class<?> layoutPolicyClass =


1442      * Frame f = ...;
1443      * f.setVisible(true);
1444      * ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
1445      * </code>
1446      *
1447      * <p> After realSync, <code>f</code> will be completely visible
1448      * on the screen, its getLocationOnScreen will be returning the
1449      * right result and it will be the focus owner.
1450      *
1451      * <p> Another example:
1452      * <code>
1453      * b.requestFocus();
1454      * ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
1455      * </code>
1456      *
1457      * <p> After realSync, <code>b</code> will be focus owner.
1458      *
1459      * <p> Notice that realSync isn't guaranteed to work if recurring
1460      * actions occur, such as if during processing of some event
1461      * another request which may generate some events occurs.  By
1462      * default, sync tries to perform as much as {@value #MAX_ITERS}
1463      * cycles of event processing, allowing for roughly {@value
1464      * #MAX_ITERS} additional requests.
1465      *
1466      * <p> For example, requestFocus() generates native request, which
1467      * generates one or two Java focus events, which then generate a
1468      * serie of paint events, a serie of Java focus events, which then
1469      * generate a serie of paint events which then are processed -
1470      * three cycles, minimum.
1471      *
1472      * @param timeout the maximum time to wait in milliseconds, negative means "forever".
1473      */
1474     public void realSync(final long timeout) throws OperationTimedOut, InfiniteLoop
1475     {
1476         if (EventQueue.isDispatchThread()) {
1477             throw new IllegalThreadException("The SunToolkit.realSync() method cannot be used on the event dispatch thread (EDT).");
1478         }
1479         int bigLoop = 0;
1480         do {
1481             // Let's do sync first
1482             sync();
1483 
1484             // During the wait process, when we were processing incoming


< prev index next >