java.awt.peer
public interface ComponentPeer
Modifier and Type | Method and Description |
---|---|
boolean |
canDetermineObscurity()
Returns
true if this component peer can determine if the
component has been obscured, false otherwise. |
int |
checkImage(Image img,
int width,
int height,
ImageObserver ob)
Returns the construction status of the specified image.
|
void |
coalescePaintEvent(PaintEvent e)
Coalesces the specified paint event.
|
void |
createBuffers(int numBuffers,
BufferCapabilities caps)
Create a number of image buffers that implement a buffering
strategy according to the given capabilities.
|
Image |
createImage(ImageProducer prod)
Creates an image by starting the specified image producer.
|
Image |
createImage(int width,
int height)
Creates an empty image with the specified
width and
height . |
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 |
flip(BufferCapabilities.FlipContents contents)
Perform a page flip, leaving the contents of the back buffer in
the specified state.
|
Image |
getBackBuffer()
Return the back buffer of this component.
|
Rectangle |
getBounds()
Get the bounds of this component peer.
|
ColorModel |
getColorModel()
Returns the color model of the component.
|
FontMetrics |
getFontMetrics(Font f)
Returns the font metrics for the specified font.
|
Graphics |
getGraphics()
Returns a
Graphics object suitable for drawing on this component. |
GraphicsConfiguration |
getGraphicsConfiguration()
Get the graphics configuration of the component.
|
Point |
getLocationOnScreen()
Returns the location of this component in screen coordinates.
|
Dimension |
getMinimumSize()
Returns the minimum size for the component.
|
Dimension |
getPreferredSize()
Returns the preferred size for the component.
|
Toolkit |
getToolkit()
Returns the toolkit that created this peer.
|
void |
handleEvent(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.
|
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 |
isReparentSupported()
Check if this component supports being reparented.
|
void |
layout()
Layout this component peer.
|
Dimension |
minimumSize()
Returns the minimum size for the component.
|
void |
paint(Graphics graphics) |
Dimension |
preferredSize()
Returns the preferred size for the component.
|
boolean |
prepareImage(Image img,
int width,
int height,
ImageObserver ob)
Prepares an image for rendering on this component.
|
void |
print(Graphics graphics) |
void |
repaint(long tm,
int x,
int y,
int width,
int height)
Repaints the specified rectangle of this component.
|
void |
reparent(ContainerPeer parent)
Reparent this component under another container.
|
void |
requestFocus()
Requests that this component receives the focus.
|
boolean |
requestFocus(Component request,
boolean temporary,
boolean allowWindowFocus,
long time)
Requests that this component receives the focus.
|
boolean |
requestFocus(Component lightweightChild,
boolean temporary,
boolean focusedWindowChangeAllowed,
long time,
CausedFocusEvent.Cause cause)
Requests the focus on the component.
|
void |
reshape(int x,
int y,
int width,
int height)
Notifies the peer that the bounds of this component have changed.
|
void |
setBackground(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 width,
int height,
int z)
Set the bounds of this component peer.
|
void |
setCursor(Cursor cursor)
Sets the cursor of the component.
|
void |
setEnabled(boolean enabled)
Sets the enabled/disabled state of this component.
|
void |
setEventMask(long mask)
Part of an older API, no longer needed.
|
void |
setFont(Font font)
Sets the font of the component.
|
void |
setForeground(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.
|
int checkImage(Image img, int width, int height, ImageObserver ob)
Component.checkImage(Image, int, int, ImageObserver)
.img
- the imagewidth
- the width of the imageheight
- the height of the imageob
- the image observer to be notified of updates of the statusImage createImage(ImageProducer prod)
Component.createImage(ImageProducer)
.prod
- the image producer to be used to create the imageImage createImage(int width, int height)
width
and
height
.width
- the width of the image to be createdheight
- the height of the image to be createdvoid disable()
Component.disable()
.void dispose()
void enable()
Component.enable()
.ColorModel getColorModel()
FontMetrics getFontMetrics(Font f)
Component.getFontMetrics(Font)
.f
- the font for which to query the font metricsGraphics getGraphics()
Graphics
object suitable for drawing on this component.
This is called by Component.getGraphics()
.Point getLocationOnScreen()
Component.getLocationOnScreen()
.Dimension getMinimumSize()
Component.getMinimumSize()
.Dimension getPreferredSize()
Component.getPreferredSize()
.Toolkit getToolkit()
void handleEvent(AWTEvent e)
Component.dispatchEvent(AWTEvent)
to give the peer a chance to
react to events for the component.e
- the eventvoid hide()
Component.hide()
.boolean isFocusTraversable()
true
if the component can receive keyboard input
focus. This is called from Component.isFocusTraversable()
.boolean isFocusable()
true
if the component can receive keyboard input
focus. This is called from Component.isFocusable()
.Dimension minimumSize()
Component.minimumSize()
.Dimension preferredSize()
Component.getPreferredSize()
.boolean prepareImage(Image img, int width, int height, ImageObserver ob)
Component.prepareImage(Image, int, int, ImageObserver)
.img
- the image to preparewidth
- the desired width of the rendered imageheight
- the desired height of the rendered imageob
- the image observer to be notified of updates in the preparation
processtrue
if the image has been fully prepared,
false
otherwise (in which case the image observer
receives updates)void repaint(long tm, int x, int y, int width, int height)
Component.repaint(long, int, int, int, int)
.tm
- number of milliseconds to wait with repaintingx
- the X coordinate of the upper left corner of the damaged rectangley
- the Y coordinate of the upper left corner of the damaged rectanglewidth
- the width of the damaged rectangleheight
- the height of the damaged rectanglevoid requestFocus()
Component.requestFocus()
.boolean requestFocus(Component request, boolean temporary, boolean allowWindowFocus, long time)
Component.requestFocus()
.
This method is only called for heavyweight component's peers. Lightweight
components ask their nearest heavyweight component to request focus.
It's up to the heavyweight peer to decide if any of it's lightweight
descendants are allowed to receive keyboard input focus or not. If the
focus request is finally approved, then the peer must post a FOCUS_GAINED
event for the requested component.request
- the component for which the focus is requestedtemporary
- indicates if the focus change is temporary (true) or
permanent (false)allowWindowFocus
- indicates if it's allowed to change window focustime
- the timestampvoid reshape(int x, int y, int width, int height)
Component.reshape(int, int, int, int)
.x
- the X coordinate of the upper left corner of the componenty
- the Y coordinate of the upper left corner of the componentwidth
- the width of the componentheight
- the height of the componentvoid setBackground(Color color)
Component.setBackground(Color)
.color
- the background color to setvoid setBounds(int x, int y, int width, int height)
Component.setBounds(int, int, int, int)
.x
- the X coordinate of the upper left corner of the componenty
- the Y coordinate of the upper left corner of the componentwidth
- the width of the componentheight
- the height of the componentvoid setCursor(Cursor cursor)
Component.setCursor(Cursor)
.void setEnabled(boolean enabled)
Component.setEnabled(boolean)
.enabled
- true
to enable the component,
false
to disable itvoid setFont(Font font)
Component.setFont(Font)
.font
- the font to setvoid setForeground(Color color)
Component.setForeground(Color)
.color
- the foreground color to setvoid setVisible(boolean visible)
Component.setVisible(boolean)
.visible
- true
to make the component visible,
false
to make it invisiblevoid show()
Component.show()
.GraphicsConfiguration getGraphicsConfiguration()
void setEventMask(long mask)
boolean isObscured()
true
if this component has been obscured,
false
otherwise. This will only work if
canDetermineObscurity()
also returns true
.true
if this component has been obscured,
false
otherwise.boolean canDetermineObscurity()
true
if this component peer can determine if the
component has been obscured, false
otherwise.true
if this component peer can determine if the
component has been obscured, false
otherwisevoid coalescePaintEvent(PaintEvent e)
e
- the paint eventvoid updateCursorImmediately()
boolean handlesWheelScrolling()
false
otherwise.false
otherwiseVolatileImage createVolatileImage(int width, int height)
width
- width of the imageheight
- height of the imageVolatileImage
void createBuffers(int numBuffers, BufferCapabilities caps) throws AWTException
numBuffers
- the number of bufferscaps
- the buffering capabilitiesAWTException
- if the specified buffering strategy is not
implementedImage getBackBuffer()
void flip(BufferCapabilities.FlipContents contents)
contents
- the state in which to leave the back buffervoid destroyBuffers()
Rectangle getBounds()
void reparent(ContainerPeer parent)
parent
- void setBounds(int x, int y, int width, int height, int z)
x
- the new x co-ordinatey
- the new y co-ordinatewidth
- the new widthheight
- the new heightz
- the new stacking levelboolean isReparentSupported()
void layout()
boolean requestFocus(Component lightweightChild, boolean temporary, boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause)