Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.java.awt.peer
Class GLightweightPeer  view GLightweightPeer download GLightweightPeer.java

java.lang.Object
  extended bygnu.java.awt.peer.GLightweightPeer
All Implemented Interfaces:
java.awt.peer.ComponentPeer, java.awt.peer.ContainerPeer, java.awt.peer.LightweightPeer

public class GLightweightPeer
extends java.lang.Object
implements java.awt.peer.LightweightPeer, java.awt.peer.ContainerPeer

A stub class that implements the ComponentPeer and ContainerPeer interfaces using callbacks into the Component and Container classes. GLightweightPeer allows the Component and Container classes to treat lightweight and heavyweight peers in the same way. Lightweight components are painted directly onto their parent containers through an Image object provided by the toolkit.


Field Summary
private  java.awt.Component comp
           
private  java.awt.Insets containerInsets
           
 
Constructor Summary
GLightweightPeer(java.awt.Component comp)
           
 
Method Summary
 void beginLayout()
           
 void beginValidate()
           
 void cancelPendingPaint(int x, int y, int width, int height)
          Cancel a pending paint event on a region of this container.
 boolean canDetermineObscurity()
          Returns true if this component peer can determine if the component has been obscured, false otherwise.
 int checkImage(java.awt.Image img, int width, int height, java.awt.image.ImageObserver o)
          Returns the construction status of the specified image.
 void coalescePaintEvent(java.awt.event.PaintEvent e)
          Coalesces the specified paint event.
 void createBuffers(int x, java.awt.BufferCapabilities capabilities)
          Create a number of image buffers that implement a buffering strategy according to the given capabilities.
 java.awt.Image createImage(java.awt.image.ImageProducer prod)
          Creates an image by starting the specified image producer.
 java.awt.Image createImage(int width, int height)
          Creates an empty image with the specified width and height.
 java.awt.image.VolatileImage createVolatileImage(int width, int height)
          A convenience method that creates a volatile image.
 void destroyBuffers()
          Destroy the resources created by createBuffers.
 void disable()
          Disables the component.
 void dispose()
          Disposes the component peer.
 void enable()
          Enables the component.
 void endLayout()
           
 void endValidate()
           
 void flip(java.awt.BufferCapabilities.FlipContents contents)
          Perform a page flip, leaving the contents of the back buffer in the specified state.
 java.awt.Image getBackBuffer()
          Return the back buffer of this component.
 java.awt.Rectangle getBounds()
          Get the bounds of this component peer.
 java.awt.image.ColorModel getColorModel()
          Returns the color model of the component.
 java.awt.FontMetrics getFontMetrics(java.awt.Font f)
          Returns the font metrics for the specified font.
 java.awt.Graphics getGraphics()
          Returns a java.awt.Graphics object suitable for drawing on this component.
 java.awt.GraphicsConfiguration getGraphicsConfiguration()
          Get the graphics configuration of the component.
 java.awt.Insets getInsets()
           
 java.awt.Point getLocationOnScreen()
          Returns the location of this component in screen coordinates.
 java.awt.Dimension getMinimumSize()
          Returns the minimum size for the component.
 java.awt.Dimension getPreferredSize()
          Returns the preferred size for the component.
 java.awt.Toolkit getToolkit()
          Returns the toolkit that created this peer.
 void handleEvent(java.awt.AWTEvent e)
          Handles the given event.
 boolean handlesWheelScrolling()
          Returns true, if this component can handle wheel scrolling, false otherwise.
 void hide()
          Makes the component invisible.
 java.awt.Insets insets()
           
 boolean isFocusable()
          Returns true if the component can receive keyboard input focus.
 boolean isFocusTraversable()
          Returns true if the component can receive keyboard input focus.
 boolean isObscured()
          Returns true if this component has been obscured, false otherwise.
 boolean isPaintPending()
           
 boolean isReparentSupported()
          Check if this component supports being reparented.
 boolean isRestackSupported()
          Check if this container peer can be restacked.
 void layout()
          Layout this component peer.
 java.awt.Dimension minimumSize()
          Returns the minimum size for the component.
 void paint(java.awt.Graphics graphics)
           
 java.awt.Dimension preferredSize()
          Returns the preferred size for the component.
 boolean prepareImage(java.awt.Image img, int width, int height, java.awt.image.ImageObserver o)
          Prepares an image for rendering on this component.
 void print(java.awt.Graphics graphics)
           
 void repaint(long tm, int x, int y, int width, int height)
          Repaints the specified rectangle of this component.
 void reparent(java.awt.peer.ContainerPeer parent)
          Reparent this component under another container.
 void requestFocus()
          Requests that this component receives the focus.
 boolean requestFocus(java.awt.Component source, boolean bool1, boolean bool2, long x)
          Requests that this component receives the focus.
 void reshape(int x, int y, int width, int height)
          Notifies the peer that the bounds of this component have changed.
 void restack()
          Restack the component peers in this container peer.
 void setBackground(java.awt.Color color)
          Sets the background color of the component.
 void setBounds(int x, int y, int width, int height)
          Notifies the peer that the bounds of this component have changed.
 void setBounds(int x, int y, int z, int width, int height)
          Set the bounds of this component peer.
 void setCursor(java.awt.Cursor cursor)
          Sets the cursor on the heavy-weight parent peer.
 void setEnabled(boolean enabled)
          Sets the enabled/disabled state of this component.
 void setEventMask(long eventMask)
          Part of an older API, no longer needed.
 void setFont(java.awt.Font font)
          Sets the font of the component.
 void setForeground(java.awt.Color color)
          Sets the foreground color of the component.
 void setVisible(boolean visible)
          Sets the visibility state of the component.
 void show()
          Makes the component visible.
 void updateCursorImmediately()
          Updates the cursor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

comp

private java.awt.Component comp

containerInsets

private java.awt.Insets containerInsets
Constructor Detail

GLightweightPeer

public GLightweightPeer(java.awt.Component comp)
Method Detail

insets

public java.awt.Insets insets()
Specified by:
insets in interface java.awt.peer.ContainerPeer

getInsets

public java.awt.Insets getInsets()
Specified by:
getInsets in interface java.awt.peer.ContainerPeer

beginValidate

public void beginValidate()
Specified by:
beginValidate in interface java.awt.peer.ContainerPeer

endValidate

public void endValidate()
Specified by:
endValidate in interface java.awt.peer.ContainerPeer

beginLayout

public void beginLayout()
Specified by:
beginLayout in interface java.awt.peer.ContainerPeer

endLayout

public void endLayout()
Specified by:
endLayout in interface java.awt.peer.ContainerPeer

isPaintPending

public boolean isPaintPending()
Specified by:
isPaintPending in interface java.awt.peer.ContainerPeer

checkImage

public int checkImage(java.awt.Image img,
                      int width,
                      int height,
                      java.awt.image.ImageObserver o)
Description copied from interface: java.awt.peer.ComponentPeer
Returns the construction status of the specified image. This is called by Component.checkImage(Image, int, int, ImageObserver)>Component.checkImage(Image, int, int, ImageObserver) 55 .

Specified by:
checkImage in interface java.awt.peer.ComponentPeer

createImage

public java.awt.Image createImage(java.awt.image.ImageProducer prod)
Description copied from interface: java.awt.peer.ComponentPeer
Creates an image by starting the specified image producer. This is called by Component.createImage(ImageProducer)>Component.createImage(ImageProducer) 55 .

Specified by:
createImage in interface java.awt.peer.ComponentPeer

createImage

public java.awt.Image createImage(int width,
                                  int height)
Description copied from interface: java.awt.peer.ComponentPeer
Creates an empty image with the specified width and height.

Specified by:
createImage in interface java.awt.peer.ComponentPeer

disable

public void disable()
Description copied from interface: java.awt.peer.ComponentPeer
Disables the component. This is called by Component.disable()>Component.disable() 55 .

Specified by:
disable in interface java.awt.peer.ComponentPeer

dispose

public void dispose()
Description copied from interface: java.awt.peer.ComponentPeer
Disposes the component peer. This should release all resources held by the peer. This is called when the component is no longer in use.

Specified by:
dispose in interface java.awt.peer.ComponentPeer

enable

public void enable()
Description copied from interface: java.awt.peer.ComponentPeer
Enables the component. This is called by Component.enable()>Component.enable() 55 .

Specified by:
enable in interface java.awt.peer.ComponentPeer

getGraphicsConfiguration

public java.awt.GraphicsConfiguration getGraphicsConfiguration()
Description copied from interface: java.awt.peer.ComponentPeer
Get the graphics configuration of the component. The color model of the component can be derived from the configuration.

Specified by:
getGraphicsConfiguration in interface java.awt.peer.ComponentPeer

getFontMetrics

public java.awt.FontMetrics getFontMetrics(java.awt.Font f)
Description copied from interface: java.awt.peer.ComponentPeer
Returns the font metrics for the specified font. This is called by Component.getFontMetrics(Font)>Component.getFontMetrics(Font) 55 .

Specified by:
getFontMetrics in interface java.awt.peer.ComponentPeer

getGraphics

public java.awt.Graphics getGraphics()
Description copied from interface: java.awt.peer.ComponentPeer
Returns a java.awt.Graphics object suitable for drawing on this component. This is called by Component.getGraphics()>Component.getGraphics() 55 .

Specified by:
getGraphics in interface java.awt.peer.ComponentPeer

getLocationOnScreen

public java.awt.Point getLocationOnScreen()
Description copied from interface: java.awt.peer.ComponentPeer
Returns the location of this component in screen coordinates. This is called by Component.getLocationOnScreen()>Component.getLocationOnScreen() 55 .

Specified by:
getLocationOnScreen in interface java.awt.peer.ComponentPeer

getMinimumSize

public java.awt.Dimension getMinimumSize()
Description copied from interface: java.awt.peer.ComponentPeer
Returns the minimum size for the component. This is called by Component.getMinimumSize()>Component.getMinimumSize() 55 .

Specified by:
getMinimumSize in interface java.awt.peer.ComponentPeer

getPreferredSize

public java.awt.Dimension getPreferredSize()
Description copied from interface: java.awt.peer.ComponentPeer
Returns the preferred size for the component. This is called by Component.getPreferredSize()>Component.getPreferredSize() 55 .

Specified by:
getPreferredSize in interface java.awt.peer.ComponentPeer

getToolkit

public java.awt.Toolkit getToolkit()
Description copied from interface: java.awt.peer.ComponentPeer
Returns the toolkit that created this peer.

Specified by:
getToolkit in interface java.awt.peer.ComponentPeer

handleEvent

public void handleEvent(java.awt.AWTEvent e)
Description copied from interface: java.awt.peer.ComponentPeer
Handles the given event. This is called from Component.dispatchEvent(AWTEvent)>Component.dispatchEvent(AWTEvent) 55 to give the peer a chance to react to events for the component.

Specified by:
handleEvent in interface java.awt.peer.ComponentPeer

hide

public void hide()
Description copied from interface: java.awt.peer.ComponentPeer
Makes the component invisible. This is called from Component.hide()>Component.hide() 55 .

Specified by:
hide in interface java.awt.peer.ComponentPeer

isFocusable

public boolean isFocusable()
Description copied from interface: java.awt.peer.ComponentPeer
Returns true if the component can receive keyboard input focus. This is called from Component.isFocusable()>Component.isFocusable() 55 .

Specified by:
isFocusable in interface java.awt.peer.ComponentPeer

isFocusTraversable

public boolean isFocusTraversable()
Description copied from interface: java.awt.peer.ComponentPeer
Returns true if the component can receive keyboard input focus. This is called from Component.isFocusTraversable()>Component.isFocusTraversable() 55 .

Specified by:
isFocusTraversable in interface java.awt.peer.ComponentPeer

minimumSize

public java.awt.Dimension minimumSize()
Description copied from interface: java.awt.peer.ComponentPeer
Returns the minimum size for the component. This is called by Component.minimumSize()>Component.minimumSize() 55 .

Specified by:
minimumSize in interface java.awt.peer.ComponentPeer

preferredSize

public java.awt.Dimension preferredSize()
Description copied from interface: java.awt.peer.ComponentPeer
Returns the preferred size for the component. This is called by Component.getPreferredSize()>Component.getPreferredSize() 55 .

Specified by:
preferredSize in interface java.awt.peer.ComponentPeer

paint

public void paint(java.awt.Graphics graphics)
Specified by:
paint in interface java.awt.peer.ComponentPeer

prepareImage

public boolean prepareImage(java.awt.Image img,
                            int width,
                            int height,
                            java.awt.image.ImageObserver o)
Description copied from interface: java.awt.peer.ComponentPeer
Prepares an image for rendering on this component. This is called by Component.prepareImage(Image, int, int, ImageObserver)>Component.prepareImage(Image, int, int, ImageObserver) 55 .

Specified by:
prepareImage in interface java.awt.peer.ComponentPeer

print

public void print(java.awt.Graphics graphics)
Specified by:
print in interface java.awt.peer.ComponentPeer

repaint

public void repaint(long tm,
                    int x,
                    int y,
                    int width,
                    int height)
Description copied from interface: java.awt.peer.ComponentPeer
Repaints the specified rectangle of this component. This is called from Component.repaint(long, int, int, int, int)>Component.repaint(long, int, int, int, int) 55 .

Specified by:
repaint in interface java.awt.peer.ComponentPeer

requestFocus

public void requestFocus()
Description copied from interface: java.awt.peer.ComponentPeer
Requests that this component receives the focus. This is called from Component.requestFocus()>Component.requestFocus() 55 .

Specified by:
requestFocus in interface java.awt.peer.ComponentPeer

requestFocus

public boolean requestFocus(java.awt.Component source,
                            boolean bool1,
                            boolean bool2,
                            long x)
Description copied from interface: java.awt.peer.ComponentPeer
Requests that this component receives the focus. This is called from Component.requestFocus()>Component.requestFocus() 55 .

Specified by:
requestFocus in interface java.awt.peer.ComponentPeer

reshape

public void reshape(int x,
                    int y,
                    int width,
                    int height)
Description copied from interface: java.awt.peer.ComponentPeer
Notifies the peer that the bounds of this component have changed. This is called by Component.reshape(int, int, int, int)>Component.reshape(int, int, int, int) 55 .

Specified by:
reshape in interface java.awt.peer.ComponentPeer

setBackground

public void setBackground(java.awt.Color color)
Description copied from interface: java.awt.peer.ComponentPeer
Sets the background color of the component. This is called by Component.setBackground(Color)>Component.setBackground(Color) 55 .

Specified by:
setBackground in interface java.awt.peer.ComponentPeer

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Description copied from interface: java.awt.peer.ComponentPeer
Notifies the peer that the bounds of this component have changed. This is called by Component.setBounds(int, int, int, int)>Component.setBounds(int, int, int, int) 55 .

Specified by:
setBounds in interface java.awt.peer.ComponentPeer

setCursor

public void setCursor(java.awt.Cursor cursor)
Sets the cursor on the heavy-weight parent peer. Called by the MouseListener on mouse enter.

Specified by:
setCursor in interface java.awt.peer.ComponentPeer

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: java.awt.peer.ComponentPeer
Sets the enabled/disabled state of this component. This is called by Component.setEnabled(boolean)>Component.setEnabled(boolean) 55 .

Specified by:
setEnabled in interface java.awt.peer.ComponentPeer

setEventMask

public void setEventMask(long eventMask)
Description copied from interface: java.awt.peer.ComponentPeer
Part of an older API, no longer needed.

Specified by:
setEventMask in interface java.awt.peer.ComponentPeer

setFont

public void setFont(java.awt.Font font)
Description copied from interface: java.awt.peer.ComponentPeer
Sets the font of the component. This is called by Component.setFont(Font)>Component.setFont(Font) 55 .

Specified by:
setFont in interface java.awt.peer.ComponentPeer

setForeground

public void setForeground(java.awt.Color color)
Description copied from interface: java.awt.peer.ComponentPeer
Sets the foreground color of the component. This is called by Component.setForeground(Color)>Component.setForeground(Color) 55 .

Specified by:
setForeground in interface java.awt.peer.ComponentPeer

setVisible

public void setVisible(boolean visible)
Description copied from interface: java.awt.peer.ComponentPeer
Sets the visibility state of the component. This is called by Component.setVisible(boolean)>Component.setVisible(boolean) 55 .

Specified by:
setVisible in interface java.awt.peer.ComponentPeer

show

public void show()
Description copied from interface: java.awt.peer.ComponentPeer
Makes the component visible. This is called by Component.show()>Component.show() 55 .

Specified by:
show in interface java.awt.peer.ComponentPeer

getColorModel

public java.awt.image.ColorModel getColorModel()
Description copied from interface: java.awt.peer.ComponentPeer
Returns the color model of the component. This is currently not used.

Specified by:
getColorModel in interface java.awt.peer.ComponentPeer

isObscured

public boolean isObscured()
Description copied from interface: java.awt.peer.ComponentPeer
Returns true if this component has been obscured, false otherwise. This will only work if ComponentPeer.canDetermineObscurity()>ComponentPeer.canDetermineObscurity() 55 also returns true.

Specified by:
isObscured in interface java.awt.peer.ComponentPeer

canDetermineObscurity

public boolean canDetermineObscurity()
Description copied from interface: java.awt.peer.ComponentPeer
Returns true if this component peer can determine if the component has been obscured, false otherwise.

Specified by:
canDetermineObscurity in interface java.awt.peer.ComponentPeer

coalescePaintEvent

public void coalescePaintEvent(java.awt.event.PaintEvent e)
Description copied from interface: java.awt.peer.ComponentPeer
Coalesces the specified paint event.

Specified by:
coalescePaintEvent in interface java.awt.peer.ComponentPeer

updateCursorImmediately

public void updateCursorImmediately()
Description copied from interface: java.awt.peer.ComponentPeer
Updates the cursor.

Specified by:
updateCursorImmediately in interface java.awt.peer.ComponentPeer

createVolatileImage

public java.awt.image.VolatileImage createVolatileImage(int width,
                                                        int height)
Description copied from interface: java.awt.peer.ComponentPeer
A convenience method that creates a volatile image. The volatile image is created on the screen device on which this component is displayed, in the device's current graphics configuration.

Specified by:
createVolatileImage in interface java.awt.peer.ComponentPeer

handlesWheelScrolling

public boolean handlesWheelScrolling()
Description copied from interface: java.awt.peer.ComponentPeer
Returns true, if this component can handle wheel scrolling, false otherwise.

Specified by:
handlesWheelScrolling in interface java.awt.peer.ComponentPeer

createBuffers

public void createBuffers(int x,
                          java.awt.BufferCapabilities capabilities)
                   throws java.awt.AWTException
Description copied from interface: java.awt.peer.ComponentPeer
Create a number of image buffers that implement a buffering strategy according to the given capabilities.

Specified by:
createBuffers in interface java.awt.peer.ComponentPeer

getBackBuffer

public java.awt.Image getBackBuffer()
Description copied from interface: java.awt.peer.ComponentPeer
Return the back buffer of this component.

Specified by:
getBackBuffer in interface java.awt.peer.ComponentPeer

flip

public void flip(java.awt.BufferCapabilities.FlipContents contents)
Description copied from interface: java.awt.peer.ComponentPeer
Perform a page flip, leaving the contents of the back buffer in the specified state.

Specified by:
flip in interface java.awt.peer.ComponentPeer

destroyBuffers

public void destroyBuffers()
Description copied from interface: java.awt.peer.ComponentPeer
Destroy the resources created by createBuffers.

Specified by:
destroyBuffers in interface java.awt.peer.ComponentPeer

isRestackSupported

public boolean isRestackSupported()
Description copied from interface: java.awt.peer.ContainerPeer
Check if this container peer can be restacked.

Specified by:
isRestackSupported in interface java.awt.peer.ContainerPeer

cancelPendingPaint

public void cancelPendingPaint(int x,
                               int y,
                               int width,
                               int height)
Description copied from interface: java.awt.peer.ContainerPeer
Cancel a pending paint event on a region of this container.

Specified by:
cancelPendingPaint in interface java.awt.peer.ContainerPeer

restack

public void restack()
Description copied from interface: java.awt.peer.ContainerPeer
Restack the component peers in this container peer.

Specified by:
restack in interface java.awt.peer.ContainerPeer

getBounds

public java.awt.Rectangle getBounds()
Description copied from interface: java.awt.peer.ComponentPeer
Get the bounds of this component peer.

Specified by:
getBounds in interface java.awt.peer.ComponentPeer

reparent

public void reparent(java.awt.peer.ContainerPeer parent)
Description copied from interface: java.awt.peer.ComponentPeer
Reparent this component under another container.

Specified by:
reparent in interface java.awt.peer.ComponentPeer

setBounds

public void setBounds(int x,
                      int y,
                      int z,
                      int width,
                      int height)
Description copied from interface: java.awt.peer.ComponentPeer
Set the bounds of this component peer.

Specified by:
setBounds in interface java.awt.peer.ComponentPeer

isReparentSupported

public boolean isReparentSupported()
Description copied from interface: java.awt.peer.ComponentPeer
Check if this component supports being reparented.

Specified by:
isReparentSupported in interface java.awt.peer.ComponentPeer

layout

public void layout()
Description copied from interface: java.awt.peer.ComponentPeer
Layout this component peer.

Specified by:
layout in interface java.awt.peer.ComponentPeer