Home » openjdk-7 » java » awt » peer » [javadoc | source]
java.awt.peer
public interface: ComponentPeer [javadoc | source]

All Known Implementing Classes:
    CanvasPeer, WindowPeer, LightweightPeer, ScrollbarPeer, PanelPeer, ContainerPeer, DialogPeer, ScrollPanePeer, FileDialogPeer, ButtonPeer, LabelPeer, FramePeer, TextFieldPeer, TextComponentPeer, CheckboxPeer, TextAreaPeer, ListPeer, ChoicePeer

The peer interface for Component . This is the top level peer interface for widgets and defines the bulk of methods for AWT component peers. Most component peers have to implement this interface (via one of the subinterfaces), except menu components, which implement MenuComponentPeer . The peer interfaces are intended only for use in porting the AWT. They are not intended for use by application developers, and developers should not implement peers nor invoke any of the peer methods directly on the peer instances.
Field Summary
public static final  int SET_LOCATION    Operation for #setBounds(int, int, int, int, int) , indicating a change in the component location only. 
public static final  int SET_SIZE    Operation for #setBounds(int, int, int, int, int) , indicating a change in the component size only. 
public static final  int SET_BOUNDS    Operation for #setBounds(int, int, int, int, int) , indicating a change in the component size and location. 
public static final  int SET_CLIENT_SIZE    Operation for #setBounds(int, int, int, int, int) , indicating a change in the component client size. This is used for setting the 'inside' size of windows, without the border insets. 
public static final  int RESET_OPERATION    Resets the setBounds() operation to DEFAULT_OPERATION. This is not passed into #setBounds(int, int, int, int, int) . TODO: This is only used internally and should probably be moved outside the peer interface.
    Also see:
    Component#setBoundsOp
 
public static final  int NO_EMBEDDED_CHECK    A flag that is used to suppress checks for embedded frames. TODO: This is only used internally and should probably be moved outside the peer interface. 
public static final  int DEFAULT_OPERATION    The default operation, which is to set size and location. TODO: This is only used internally and should probably be moved outside the peer interface.
    Also see:
    Component#setBoundsOp
 
Method from java.awt.peer.ComponentPeer Summary:
applyShape,   canDetermineObscurity,   checkImage,   coalescePaintEvent,   createBuffers,   createImage,   createImage,   createVolatileImage,   destroyBuffers,   dispose,   flip,   getBackBuffer,   getColorModel,   getFontMetrics,   getGraphics,   getGraphicsConfiguration,   getLocationOnScreen,   getMinimumSize,   getPreferredSize,   getToolkit,   handleEvent,   handlesWheelScrolling,   isFocusable,   isObscured,   isReparentSupported,   layout,   paint,   prepareImage,   print,   reparent,   requestFocus,   setBackground,   setBounds,   setEnabled,   setFont,   setForeground,   setVisible,   setZOrder,   updateCursorImmediately,   updateGraphicsData
Method from java.awt.peer.ComponentPeer Detail:
 public  void applyShape(Region shape)
    Applies the shape to the native component window.
 public boolean canDetermineObscurity()
    Returns {@code true} when the peer can determine if a component has been obscured, {@code false} false otherwise.
 public int checkImage(Image img,
    int w,
    int h,
    ImageObserver o)
    Determines the status of the construction of the screen representaion of the specified image.
 public  void coalescePaintEvent(PaintEvent e)
    Called to coalesce paint events.
 public  void createBuffers(int numBuffers,
    BufferCapabilities caps) throws AWTException
    Create {@code numBuffers} flipping buffers with the specified buffer capabilities.
 public Image createImage(ImageProducer producer)
    Creates an image using the specified image producer.
 public Image createImage(int width,
    int height)
    Creates an empty image with the specified width and height. This is generally used as a non-accelerated backbuffer for drawing onto the component (e.g. by Swing).
 public VolatileImage createVolatileImage(int width,
    int height)
    Creates an empty volatile image with the specified width and height. This is generally used as an accelerated backbuffer for drawing onto the component (e.g. by Swing).
 public  void destroyBuffers()
    Destroys all created buffers.
 public  void dispose()
    Disposes all resources held by the component peer. This is called when the component has been disconnected from the component hierarchy and is about to be garbage collected.
 public  void flip(int x1,
    int y1,
    int x2,
    int y2,
    FlipContents flipAction)
    Move the back buffer to the front buffer.
 public Image getBackBuffer()
    Returns the back buffer as image.
 public ColorModel getColorModel()
    Returns the color model used by the component.
 public FontMetrics getFontMetrics(Font font)
    Returns a font metrics object to determine the metrics properties of the specified font.
 public Graphics getGraphics()
    Returns a graphics object to paint on the component.
 public GraphicsConfiguration getGraphicsConfiguration()
    Returns the graphics configuration that corresponds to this component.
 public Point getLocationOnScreen()
    Determines the location of the component on the screen.
 public Dimension getMinimumSize()
    Determines the minimum size of the component.
 public Dimension getPreferredSize()
    Determines the preferred size of the component.
 public Toolkit getToolkit()
    Returns the toolkit that is responsible for the component.
 public  void handleEvent(AWTEvent e)
    Called to let the component peer handle events.
 public boolean handlesWheelScrolling()
    Determines if the component handles wheel scrolling itself. Otherwise it is delegated to the component's parent.
 public boolean isFocusable()
    Returns {@code true} when the component takes part in the focus traversal, {@code false} otherwise.
 public boolean isObscured()
    Determines if a component has been obscured, i.e. by an overlapping window or similar. This is used by JViewport for optimizing performance. This doesn't have to be implemented, when #canDetermineObscurity() returns {@code false}.
 public boolean isReparentSupported()
    Returns whether this peer supports reparenting to another parent without destroying the peer.
 public  void layout()
    Used by lightweight implementations to tell a ComponentPeer to layout its sub-elements. For instance, a lightweight Checkbox needs to layout the box, as well as the text label.
 public  void paint(Graphics g)
 public boolean prepareImage(Image img,
    int w,
    int h,
    ImageObserver o)
    Prepare the specified image for rendering on this component. This should start loading the image (if not already loaded) and create an appropriate screen representation.
 public  void print(Graphics g)
 public  void reparent(ContainerPeer newContainer)
    Reparents this peer to the new parent referenced by {@code newContainer} peer. Implementation depends on toolkit and container.
 public boolean requestFocus(Component lightweightChild,
    boolean temporary,
    boolean focusedWindowChangeAllowed,
    long time,
    Cause cause)
    Requests focus on this component.
 public  void setBackground(Color c)
    Sets the background color of this component.
 public  void setBounds(int x,
    int y,
    int width,
    int height,
    int op)
    Sets the location or size or both of the component. The location is specified relative to the component's parent. The {@code op} parameter specifies which properties change. If it is #SET_LOCATION , then only the location changes (and the size parameters can be ignored). If {@code op} is #SET_SIZE , then only the size changes (and the location can be ignored). If {@code op} is #SET_BOUNDS , then both change. There is a special value #SET_CLIENT_SIZE , which is used only for window-like components to set the size of the client (i.e. the 'inner' size, without the insets of the window borders).
 public  void setEnabled(boolean e)
    Enables or disables a component. Disabled components are usually grayed out and cannot be activated.
 public  void setFont(Font f)
    Sets the font of this component.
 public  void setForeground(Color c)
    Sets the foreground color of this component.
 public  void setVisible(boolean v)
    Makes a component visible or invisible.
 public  void setZOrder(ComponentPeer above)
    Lowers this component at the bottom of the above HW peer. If the above parameter is null then the method places this component at the top of the Z-order.
 public  void updateCursorImmediately()
    Updates the cursor of the component.
 public boolean updateGraphicsData(GraphicsConfiguration gc)
    Updates internal data structures related to the component's GC.