< prev index next >

src/java.desktop/share/classes/java/awt/Component.java

Print this page




 828 
 829     // Whether this Component has had the background erase flag
 830     // specified via SunToolkit.disableBackgroundErase(). This is
 831     // needed in order to make this function work on X11 platforms,
 832     // where currently there is no chance to interpose on the creation
 833     // of the peer and therefore the call to XSetBackground.
 834     transient boolean backgroundEraseDisabled;
 835 
 836     static {
 837         AWTAccessor.setComponentAccessor(new AWTAccessor.ComponentAccessor() {
 838             public void setBackgroundEraseDisabled(Component comp, boolean disabled) {
 839                 comp.backgroundEraseDisabled = disabled;
 840             }
 841             public boolean getBackgroundEraseDisabled(Component comp) {
 842                 return comp.backgroundEraseDisabled;
 843             }
 844             public Rectangle getBounds(Component comp) {
 845                 return new Rectangle(comp.x, comp.y, comp.width, comp.height);
 846             }
 847             public void setMixingCutoutShape(Component comp, Shape shape) {
 848                 Region region = shape == null ?  null :
 849                     Region.getInstance(shape, null);
 850 
 851                 synchronized (comp.getTreeLock()) {
 852                     boolean needShowing = false;
 853                     boolean needHiding = false;
 854 
 855                     if (!comp.isNonOpaqueForMixing()) {
 856                         needHiding = true;
 857                     }
 858 
 859                     comp.mixingCutoutRegion = region;
 860 
 861                     if (!comp.isNonOpaqueForMixing()) {
 862                         needShowing = true;
 863                     }
 864 
 865                     if (comp.isMixingNeeded()) {
 866                         if (needHiding) {
 867                             comp.mixOnHiding(comp.isLightweight());
 868                         }
 869                         if (needShowing) {
 870                             comp.mixOnShowing();
 871                         }
 872                     }
 873                 }
 874             }
 875 
 876             public void setGraphicsConfiguration(Component comp,
 877                     GraphicsConfiguration gc)
 878             {
 879                 comp.setGraphicsConfiguration(gc);
 880             }
 881             public boolean requestFocus(Component comp, CausedFocusEvent.Cause cause) {
 882                 return comp.requestFocus(cause);
 883             }
 884             public boolean canBeFocusOwner(Component comp) {
 885                 return comp.canBeFocusOwner();
 886             }
 887 
 888             public boolean isVisible(Component comp) {
 889                 return comp.isVisible_NoClientCode();
 890             }
 891             public void setRequestFocusController
 892                 (RequestFocusController requestController)
 893             {


 968 
 969             public AccessControlContext getAccessControlContext(Component comp) {
 970                 return comp.getAccessControlContext();
 971             }
 972 
 973             public void revalidateSynchronously(Component comp) {
 974                 comp.revalidateSynchronously();
 975             }
 976 
 977             @Override
 978             public void createBufferStrategy(Component comp, int numBuffers,
 979                     BufferCapabilities caps) throws AWTException {
 980                 comp.createBufferStrategy(numBuffers, caps);
 981             }
 982 
 983             @Override
 984             public BufferStrategy getBufferStrategy(Component comp) {
 985                 return comp.getBufferStrategy();
 986             }
 987         });





























 988     }
 989 
 990     /**
 991      * Constructs a new component. Class <code>Component</code> can be
 992      * extended directly to create a lightweight component that does not
 993      * utilize an opaque native window. A lightweight component must be
 994      * hosted by a native container somewhere higher up in the component
 995      * tree (for example, by a <code>Frame</code> object).
 996      */
 997     protected Component() {
 998         appContext = AppContext.getAppContext();
 999     }
1000 
1001     @SuppressWarnings({"rawtypes", "unchecked"})
1002     void initializeFocusTraversalKeys() {
1003         focusTraversalKeys = new Set[3];
1004     }
1005 
1006     /**
1007      * Constructs a name for this component.  Called by <code>getName</code>




 828 
 829     // Whether this Component has had the background erase flag
 830     // specified via SunToolkit.disableBackgroundErase(). This is
 831     // needed in order to make this function work on X11 platforms,
 832     // where currently there is no chance to interpose on the creation
 833     // of the peer and therefore the call to XSetBackground.
 834     transient boolean backgroundEraseDisabled;
 835 
 836     static {
 837         AWTAccessor.setComponentAccessor(new AWTAccessor.ComponentAccessor() {
 838             public void setBackgroundEraseDisabled(Component comp, boolean disabled) {
 839                 comp.backgroundEraseDisabled = disabled;
 840             }
 841             public boolean getBackgroundEraseDisabled(Component comp) {
 842                 return comp.backgroundEraseDisabled;
 843             }
 844             public Rectangle getBounds(Component comp) {
 845                 return new Rectangle(comp.x, comp.y, comp.width, comp.height);
 846             }
 847             public void setMixingCutoutShape(Component comp, Shape shape) {
 848                 comp.setMixingCutoutShape(shape);

























 849             }
 850 
 851             public void setGraphicsConfiguration(Component comp,
 852                     GraphicsConfiguration gc)
 853             {
 854                 comp.setGraphicsConfiguration(gc);
 855             }
 856             public boolean requestFocus(Component comp, CausedFocusEvent.Cause cause) {
 857                 return comp.requestFocus(cause);
 858             }
 859             public boolean canBeFocusOwner(Component comp) {
 860                 return comp.canBeFocusOwner();
 861             }
 862 
 863             public boolean isVisible(Component comp) {
 864                 return comp.isVisible_NoClientCode();
 865             }
 866             public void setRequestFocusController
 867                 (RequestFocusController requestController)
 868             {


 943 
 944             public AccessControlContext getAccessControlContext(Component comp) {
 945                 return comp.getAccessControlContext();
 946             }
 947 
 948             public void revalidateSynchronously(Component comp) {
 949                 comp.revalidateSynchronously();
 950             }
 951 
 952             @Override
 953             public void createBufferStrategy(Component comp, int numBuffers,
 954                     BufferCapabilities caps) throws AWTException {
 955                 comp.createBufferStrategy(numBuffers, caps);
 956             }
 957 
 958             @Override
 959             public BufferStrategy getBufferStrategy(Component comp) {
 960                 return comp.getBufferStrategy();
 961             }
 962         });
 963     }
 964 
 965     private void setMixingCutoutShape(Shape shape) {
 966         Region region = shape == null ? null :
 967                 Region.getInstance(shape, null);
 968 
 969         synchronized (getTreeLock()) {
 970             boolean needShowing = false;
 971             boolean needHiding = false;
 972 
 973             if (!isNonOpaqueForMixing()) {
 974                 needHiding = true;
 975             }
 976 
 977             mixingCutoutRegion = region;
 978 
 979             if (!isNonOpaqueForMixing()) {
 980                 needShowing = true;
 981             }
 982 
 983             if (isMixingNeeded()) {
 984                 if (needHiding) {
 985                     mixOnHiding(isLightweight());
 986                 }
 987                 if (needShowing) {
 988                     mixOnShowing();
 989                 }
 990             }
 991         }
 992     }
 993 
 994     /**
 995      * Constructs a new component. Class <code>Component</code> can be
 996      * extended directly to create a lightweight component that does not
 997      * utilize an opaque native window. A lightweight component must be
 998      * hosted by a native container somewhere higher up in the component
 999      * tree (for example, by a <code>Frame</code> object).
1000      */
1001     protected Component() {
1002         appContext = AppContext.getAppContext();
1003     }
1004 
1005     @SuppressWarnings({"rawtypes", "unchecked"})
1006     void initializeFocusTraversalKeys() {
1007         focusTraversalKeys = new Set[3];
1008     }
1009 
1010     /**
1011      * Constructs a name for this component.  Called by <code>getName</code>


< prev index next >