860 if (!comp.isNonOpaqueForMixing()) {
861 needShowing = true;
862 }
863
864 if (comp.isMixingNeeded()) {
865 if (needHiding) {
866 comp.mixOnHiding(comp.isLightweight());
867 }
868 if (needShowing) {
869 comp.mixOnShowing();
870 }
871 }
872 }
873 }
874
875 public void setGraphicsConfiguration(Component comp,
876 GraphicsConfiguration gc)
877 {
878 comp.setGraphicsConfiguration(gc);
879 }
880 public boolean requestFocus(Component comp, FocusEvent.Cause cause) {
881 return comp.requestFocus(cause);
882 }
883 public boolean canBeFocusOwner(Component comp) {
884 return comp.canBeFocusOwner();
885 }
886
887 public boolean isVisible(Component comp) {
888 return comp.isVisible_NoClientCode();
889 }
890 public void setRequestFocusController
891 (RequestFocusController requestController)
892 {
893 Component.setRequestFocusController(requestController);
894 }
895 public AppContext getAppContext(Component comp) {
896 return comp.appContext;
897 }
898 public void setAppContext(Component comp, AppContext appContext) {
899 comp.appContext = appContext;
900 }
901 public Container getParent(Component comp) {
7520 * Because the focus behavior of this method is platform-dependent,
7521 * developers are strongly encouraged to use
7522 * {@code requestFocusInWindow} when possible.
7523 *
7524 * <p>Note: Not all focus transfers result from invoking this method. As
7525 * such, a component may receive focus without this or any of the other
7526 * {@code requestFocus} methods of {@code Component} being invoked.
7527 *
7528 * @see #requestFocusInWindow
7529 * @see java.awt.event.FocusEvent
7530 * @see #addFocusListener
7531 * @see #isFocusable
7532 * @see #isDisplayable
7533 * @see KeyboardFocusManager#clearGlobalFocusOwner
7534 * @since 1.0
7535 */
7536 public void requestFocus() {
7537 requestFocusHelper(false, true);
7538 }
7539
7540 boolean requestFocus(FocusEvent.Cause cause) {
7541 return requestFocusHelper(false, true, cause);
7542 }
7543
7544 /**
7545 * Requests that this {@code Component} get the input focus,
7546 * and that this {@code Component}'s top-level ancestor
7547 * become the focused {@code Window}. This component must be
7548 * displayable, focusable, visible and all of its ancestors (with
7549 * the exception of the top-level Window) must be visible for the
7550 * request to be granted. Every effort will be made to honor the
7551 * request; however, in some cases it may be impossible to do
7552 * so. Developers must never assume that this component is the
7553 * focus owner until this component receives a FOCUS_GAINED
7554 * event. If this request is denied because this component's
7555 * top-level window cannot become the focused window, the request
7556 * will be remembered and will be granted when the window is later
7557 * focused by the user.
7558 * <p>
7559 * This method returns a boolean value. If {@code false} is returned,
7560 * the request is <b>guaranteed to fail</b>. If {@code true} is
7561 * returned, the request will succeed <b>unless</b> it is vetoed, or an
7587 * such, a component may receive focus without this or any of the other
7588 * {@code requestFocus} methods of {@code Component} being invoked.
7589 *
7590 * @param temporary true if the focus change is temporary,
7591 * such as when the window loses the focus; for
7592 * more information on temporary focus changes see the
7593 *<a href="../../java/awt/doc-files/FocusSpec.html">Focus Specification</a>
7594 * @return {@code false} if the focus change request is guaranteed to
7595 * fail; {@code true} if it is likely to succeed
7596 * @see java.awt.event.FocusEvent
7597 * @see #addFocusListener
7598 * @see #isFocusable
7599 * @see #isDisplayable
7600 * @see KeyboardFocusManager#clearGlobalFocusOwner
7601 * @since 1.4
7602 */
7603 protected boolean requestFocus(boolean temporary) {
7604 return requestFocusHelper(temporary, true);
7605 }
7606
7607 boolean requestFocus(boolean temporary, FocusEvent.Cause cause) {
7608 return requestFocusHelper(temporary, true, cause);
7609 }
7610 /**
7611 * Requests that this Component get the input focus, if this
7612 * Component's top-level ancestor is already the focused
7613 * Window. This component must be displayable, focusable, visible
7614 * and all of its ancestors (with the exception of the top-level
7615 * Window) must be visible for the request to be granted. Every
7616 * effort will be made to honor the request; however, in some
7617 * cases it may be impossible to do so. Developers must never
7618 * assume that this Component is the focus owner until this
7619 * Component receives a FOCUS_GAINED event.
7620 * <p>
7621 * This method returns a boolean value. If {@code false} is returned,
7622 * the request is <b>guaranteed to fail</b>. If {@code true} is
7623 * returned, the request will succeed <b>unless</b> it is vetoed, or an
7624 * extraordinary event, such as disposal of the Component's peer, occurs
7625 * before the request can be granted by the native windowing system. Again,
7626 * while a return value of {@code true} indicates that the request is
7627 * likely to succeed, developers must never assume that this Component is
7628 * the focus owner until this Component receives a FOCUS_GAINED event.
7629 * <p>
7638 * different platforms.
7639 *
7640 * <p>Note: Not all focus transfers result from invoking this method. As
7641 * such, a component may receive focus without this or any of the other
7642 * {@code requestFocus} methods of {@code Component} being invoked.
7643 *
7644 * @return {@code false} if the focus change request is guaranteed to
7645 * fail; {@code true} if it is likely to succeed
7646 * @see #requestFocus
7647 * @see java.awt.event.FocusEvent
7648 * @see #addFocusListener
7649 * @see #isFocusable
7650 * @see #isDisplayable
7651 * @see KeyboardFocusManager#clearGlobalFocusOwner
7652 * @since 1.4
7653 */
7654 public boolean requestFocusInWindow() {
7655 return requestFocusHelper(false, false);
7656 }
7657
7658 boolean requestFocusInWindow(FocusEvent.Cause cause) {
7659 return requestFocusHelper(false, false, cause);
7660 }
7661
7662 /**
7663 * Requests that this {@code Component} get the input focus,
7664 * if this {@code Component}'s top-level ancestor is already
7665 * the focused {@code Window}. This component must be
7666 * displayable, focusable, visible and all of its ancestors (with
7667 * the exception of the top-level Window) must be visible for the
7668 * request to be granted. Every effort will be made to honor the
7669 * request; however, in some cases it may be impossible to do
7670 * so. Developers must never assume that this component is the
7671 * focus owner until this component receives a FOCUS_GAINED event.
7672 * <p>
7673 * This method returns a boolean value. If {@code false} is returned,
7674 * the request is <b>guaranteed to fail</b>. If {@code true} is
7675 * returned, the request will succeed <b>unless</b> it is vetoed, or an
7676 * extraordinary event, such as disposal of the component's peer, occurs
7677 * before the request can be granted by the native windowing system. Again,
7678 * while a return value of {@code true} indicates that the request is
|
860 if (!comp.isNonOpaqueForMixing()) {
861 needShowing = true;
862 }
863
864 if (comp.isMixingNeeded()) {
865 if (needHiding) {
866 comp.mixOnHiding(comp.isLightweight());
867 }
868 if (needShowing) {
869 comp.mixOnShowing();
870 }
871 }
872 }
873 }
874
875 public void setGraphicsConfiguration(Component comp,
876 GraphicsConfiguration gc)
877 {
878 comp.setGraphicsConfiguration(gc);
879 }
880 public void requestFocus(Component comp, FocusEvent.Cause cause) {
881 comp.requestFocus(cause);
882 }
883 public boolean canBeFocusOwner(Component comp) {
884 return comp.canBeFocusOwner();
885 }
886
887 public boolean isVisible(Component comp) {
888 return comp.isVisible_NoClientCode();
889 }
890 public void setRequestFocusController
891 (RequestFocusController requestController)
892 {
893 Component.setRequestFocusController(requestController);
894 }
895 public AppContext getAppContext(Component comp) {
896 return comp.appContext;
897 }
898 public void setAppContext(Component comp, AppContext appContext) {
899 comp.appContext = appContext;
900 }
901 public Container getParent(Component comp) {
7520 * Because the focus behavior of this method is platform-dependent,
7521 * developers are strongly encouraged to use
7522 * {@code requestFocusInWindow} when possible.
7523 *
7524 * <p>Note: Not all focus transfers result from invoking this method. As
7525 * such, a component may receive focus without this or any of the other
7526 * {@code requestFocus} methods of {@code Component} being invoked.
7527 *
7528 * @see #requestFocusInWindow
7529 * @see java.awt.event.FocusEvent
7530 * @see #addFocusListener
7531 * @see #isFocusable
7532 * @see #isDisplayable
7533 * @see KeyboardFocusManager#clearGlobalFocusOwner
7534 * @since 1.0
7535 */
7536 public void requestFocus() {
7537 requestFocusHelper(false, true);
7538 }
7539
7540
7541 /**
7542 * Requests by the reason of {@code cause} that this Component get the input
7543 * focus, and that this Component's top-level ancestor become the
7544 * focused Window. This component must be displayable, focusable, visible
7545 * and all of its ancestors (with the exception of the top-level Window)
7546 * must be visible for the request to be granted. Every effort will be
7547 * made to honor the request; however, in some cases it may be
7548 * impossible to do so. Developers must never assume that this
7549 * Component is the focus owner until this Component receives a
7550 * FOCUS_GAINED event.
7551 * <p>
7552 * The focus request effect may also depend on the provided
7553 * cause value. If this request is succeed the {@code FocusEvent}
7554 * generated in the result will receive the cause value specified as the
7555 * argument of method. If this request is denied because this Component's
7556 * top-level Window cannot become the focused Window, the request will be
7557 * remembered and will be granted when the Window is later focused by the
7558 * user.
7559 * <p>
7560 * This method cannot be used to set the focus owner to no Component at
7561 * all. Use {@code KeyboardFocusManager.clearGlobalFocusOwner()}
7562 * instead.
7563 * <p>
7564 * Because the focus behavior of this method is platform-dependent,
7565 * developers are strongly encouraged to use
7566 * {@code requestFocusInWindow(FocusEvent.Cause)} when possible.
7567 *
7568 * <p>Note: Not all focus transfers result from invoking this method. As
7569 * such, a component may receive focus without this or any of the other
7570 * {@code requestFocus} methods of {@code Component} being invoked.
7571 *
7572 * @param cause the cause why the focus is requested
7573 * @see FocusEvent
7574 * @see FocusEvent.Cause
7575 * @see #requestFocusInWindow(FocusEvent.Cause)
7576 * @see java.awt.event.FocusEvent
7577 * @see #addFocusListener
7578 * @see #isFocusable
7579 * @see #isDisplayable
7580 * @see KeyboardFocusManager#clearGlobalFocusOwner
7581 * @since 9
7582 */
7583 public void requestFocus(FocusEvent.Cause cause) {
7584 requestFocusHelper(false, true, cause);
7585 }
7586
7587 /**
7588 * Requests that this {@code Component} get the input focus,
7589 * and that this {@code Component}'s top-level ancestor
7590 * become the focused {@code Window}. This component must be
7591 * displayable, focusable, visible and all of its ancestors (with
7592 * the exception of the top-level Window) must be visible for the
7593 * request to be granted. Every effort will be made to honor the
7594 * request; however, in some cases it may be impossible to do
7595 * so. Developers must never assume that this component is the
7596 * focus owner until this component receives a FOCUS_GAINED
7597 * event. If this request is denied because this component's
7598 * top-level window cannot become the focused window, the request
7599 * will be remembered and will be granted when the window is later
7600 * focused by the user.
7601 * <p>
7602 * This method returns a boolean value. If {@code false} is returned,
7603 * the request is <b>guaranteed to fail</b>. If {@code true} is
7604 * returned, the request will succeed <b>unless</b> it is vetoed, or an
7630 * such, a component may receive focus without this or any of the other
7631 * {@code requestFocus} methods of {@code Component} being invoked.
7632 *
7633 * @param temporary true if the focus change is temporary,
7634 * such as when the window loses the focus; for
7635 * more information on temporary focus changes see the
7636 *<a href="../../java/awt/doc-files/FocusSpec.html">Focus Specification</a>
7637 * @return {@code false} if the focus change request is guaranteed to
7638 * fail; {@code true} if it is likely to succeed
7639 * @see java.awt.event.FocusEvent
7640 * @see #addFocusListener
7641 * @see #isFocusable
7642 * @see #isDisplayable
7643 * @see KeyboardFocusManager#clearGlobalFocusOwner
7644 * @since 1.4
7645 */
7646 protected boolean requestFocus(boolean temporary) {
7647 return requestFocusHelper(temporary, true);
7648 }
7649
7650 /**
7651 * Requests by the reason of {@code cause} that this {@code Component} get
7652 * the input focus, and that this {@code Component}'s top-level ancestor
7653 * become the focused {@code Window}. This component must be
7654 * displayable, focusable, visible and all of its ancestors (with
7655 * the exception of the top-level Window) must be visible for the
7656 * request to be granted. Every effort will be made to honor the
7657 * request; however, in some cases it may be impossible to do
7658 * so. Developers must never assume that this component is the
7659 * focus owner until this component receives a FOCUS_GAINED
7660 * event. If this request is denied because this component's
7661 * top-level window cannot become the focused window, the request
7662 * will be remembered and will be granted when the window is later
7663 * focused by the user.
7664 * <p>
7665 * This method returns a boolean value. If {@code false} is returned,
7666 * the request is <b>guaranteed to fail</b>. If {@code true} is
7667 * returned, the request will succeed <b>unless</b> it is vetoed, or an
7668 * extraordinary event, such as disposal of the component's peer, occurs
7669 * before the request can be granted by the native windowing system. Again,
7670 * while a return value of {@code true} indicates that the request is
7671 * likely to succeed, developers must never assume that this component is
7672 * the focus owner until this component receives a FOCUS_GAINED event.
7673 * <p>
7674 * The focus request effect may also depend on the provided
7675 * cause value. If this request is succeed the {FocusEvent}
7676 * generated in the result will receive the cause value specified as the
7677 * argument of the method.
7678 * <p>
7679 * This method cannot be used to set the focus owner to no component at
7680 * all. Use {@code KeyboardFocusManager.clearGlobalFocusOwner}
7681 * instead.
7682 * <p>
7683 * Because the focus behavior of this method is platform-dependent,
7684 * developers are strongly encouraged to use
7685 * {@code requestFocusInWindow} when possible.
7686 * <p>
7687 * Every effort will be made to ensure that {@code FocusEvent}s
7688 * generated as a
7689 * result of this request will have the specified temporary value. However,
7690 * because specifying an arbitrary temporary state may not be implementable
7691 * on all native windowing systems, correct behavior for this method can be
7692 * guaranteed only for lightweight {@code Component}s.
7693 * This method is not intended
7694 * for general use, but exists instead as a hook for lightweight component
7695 * libraries, such as Swing.
7696 * <p>
7697 * Note: Not all focus transfers result from invoking this method. As
7698 * such, a component may receive focus without this or any of the other
7699 * {@code requestFocus} methods of {@code Component} being invoked.
7700 *
7701 * @param temporary true if the focus change is temporary,
7702 * such as when the window loses the focus; for
7703 * more information on temporary focus changes see the
7704 *<a href="../../java/awt/doc-files/FocusSpec.html">Focus Specification</a>
7705 *
7706 * @param cause the cause why the focus is requested
7707 * @return {@code false} if the focus change request is guaranteed to
7708 * fail; {@code true} if it is likely to succeed
7709 * @see FocusEvent
7710 * @see FocusEvent.Cause
7711 * @see #addFocusListener
7712 * @see #isFocusable
7713 * @see #isDisplayable
7714 * @see KeyboardFocusManager#clearGlobalFocusOwner
7715 * @since 9
7716 */
7717 protected boolean requestFocus(boolean temporary, FocusEvent.Cause cause) {
7718 return requestFocusHelper(temporary, true, cause);
7719 }
7720
7721 /**
7722 * Requests that this Component get the input focus, if this
7723 * Component's top-level ancestor is already the focused
7724 * Window. This component must be displayable, focusable, visible
7725 * and all of its ancestors (with the exception of the top-level
7726 * Window) must be visible for the request to be granted. Every
7727 * effort will be made to honor the request; however, in some
7728 * cases it may be impossible to do so. Developers must never
7729 * assume that this Component is the focus owner until this
7730 * Component receives a FOCUS_GAINED event.
7731 * <p>
7732 * This method returns a boolean value. If {@code false} is returned,
7733 * the request is <b>guaranteed to fail</b>. If {@code true} is
7734 * returned, the request will succeed <b>unless</b> it is vetoed, or an
7735 * extraordinary event, such as disposal of the Component's peer, occurs
7736 * before the request can be granted by the native windowing system. Again,
7737 * while a return value of {@code true} indicates that the request is
7738 * likely to succeed, developers must never assume that this Component is
7739 * the focus owner until this Component receives a FOCUS_GAINED event.
7740 * <p>
7749 * different platforms.
7750 *
7751 * <p>Note: Not all focus transfers result from invoking this method. As
7752 * such, a component may receive focus without this or any of the other
7753 * {@code requestFocus} methods of {@code Component} being invoked.
7754 *
7755 * @return {@code false} if the focus change request is guaranteed to
7756 * fail; {@code true} if it is likely to succeed
7757 * @see #requestFocus
7758 * @see java.awt.event.FocusEvent
7759 * @see #addFocusListener
7760 * @see #isFocusable
7761 * @see #isDisplayable
7762 * @see KeyboardFocusManager#clearGlobalFocusOwner
7763 * @since 1.4
7764 */
7765 public boolean requestFocusInWindow() {
7766 return requestFocusHelper(false, false);
7767 }
7768
7769 /**
7770 * Requests by the reason of {@code cause} that this Component get the input
7771 * focus, if this Component's top-level ancestor is already the focused
7772 * Window. This component must be displayable, focusable, visible
7773 * and all of its ancestors (with the exception of the top-level
7774 * Window) must be visible for the request to be granted. Every
7775 * effort will be made to honor the request; however, in some
7776 * cases it may be impossible to do so. Developers must never
7777 * assume that this Component is the focus owner until this
7778 * Component receives a FOCUS_GAINED event.
7779 * <p>
7780 * This method returns a boolean value. If {@code false} is returned,
7781 * the request is <b>guaranteed to fail</b>. If {@code true} is
7782 * returned, the request will succeed <b>unless</b> it is vetoed, or an
7783 * extraordinary event, such as disposal of the Component's peer, occurs
7784 * before the request can be granted by the native windowing system. Again,
7785 * while a return value of {@code true} indicates that the request is
7786 * likely to succeed, developers must never assume that this Component is
7787 * the focus owner until this Component receives a FOCUS_GAINED event.
7788 * <p>
7789 * The focus request effect may also depend on the provided
7790 * cause value. If this request is succeed the {@code FocusEvent}
7791 * generated in the result will receive the cause value specified as the
7792 * argument of the method.
7793 * <p>
7794 * This method cannot be used to set the focus owner to no Component at
7795 * all. Use {@code KeyboardFocusManager.clearGlobalFocusOwner()}
7796 * instead.
7797 * <p>
7798 * The focus behavior of this method can be implemented uniformly across
7799 * platforms, and thus developers are strongly encouraged to use this
7800 * method over {@code requestFocus(FocusEvent.Cause)} when possible.
7801 * Code which relies on {@code requestFocus(FocusEvent.Cause)} may exhibit
7802 * different focus behavior on different platforms.
7803 *
7804 * <p>Note: Not all focus transfers result from invoking this method. As
7805 * such, a component may receive focus without this or any of the other
7806 * {@code requestFocus} methods of {@code Component} being invoked.
7807 *
7808 * @param cause the cause why the focus is requested
7809 * @return {@code false} if the focus change request is guaranteed to
7810 * fail; {@code true} if it is likely to succeed
7811 * @see #requestFocus(FocusEvent.Cause)
7812 * @see FocusEvent
7813 * @see FocusEvent.Cause
7814 * @see java.awt.event.FocusEvent
7815 * @see #addFocusListener
7816 * @see #isFocusable
7817 * @see #isDisplayable
7818 * @see KeyboardFocusManager#clearGlobalFocusOwner
7819 * @since 9
7820 */
7821 public boolean requestFocusInWindow(FocusEvent.Cause cause) {
7822 return requestFocusHelper(false, false, cause);
7823 }
7824
7825 /**
7826 * Requests that this {@code Component} get the input focus,
7827 * if this {@code Component}'s top-level ancestor is already
7828 * the focused {@code Window}. This component must be
7829 * displayable, focusable, visible and all of its ancestors (with
7830 * the exception of the top-level Window) must be visible for the
7831 * request to be granted. Every effort will be made to honor the
7832 * request; however, in some cases it may be impossible to do
7833 * so. Developers must never assume that this component is the
7834 * focus owner until this component receives a FOCUS_GAINED event.
7835 * <p>
7836 * This method returns a boolean value. If {@code false} is returned,
7837 * the request is <b>guaranteed to fail</b>. If {@code true} is
7838 * returned, the request will succeed <b>unless</b> it is vetoed, or an
7839 * extraordinary event, such as disposal of the component's peer, occurs
7840 * before the request can be granted by the native windowing system. Again,
7841 * while a return value of {@code true} indicates that the request is
|