|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Canvas | +--adm.CCanvas | +--adm.CAnimatedCanvas
CAnimatedCanvas class extends CCanvas and implements double buffering.
It can be used as a base class for widgets with complicated graphics.
The background paint and foreground paint are separated in this class.
The background painted is only called the first time in the paint method.
Only the foreground paint is performed for each update. This provides
a better image update (smoother) and an efficient paint. It is better to
use this base class when developing widgets with the complicated
backgrounds or dynamic graphics.
CAnimatedCanvas is abstract class. The derived classes must implement
paintBackground and paintForeground methods.
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Constructor Summary | |
CAnimatedCanvas()
Null Constructor |
|
CAnimatedCanvas(int width,
int height)
Constructor Defines the canvas size and uses default foreground and background colors. |
|
CAnimatedCanvas(int width,
int height,
java.awt.Color fg,
java.awt.Color bg)
Constructor Defines the canvas size and sets foreground and background colors. |
|
CAnimatedCanvas(java.lang.String dName,
java.lang.String pName)
Constructor with device name and property name |
Method Summary | |
void |
deviceChanged(DeviceEvent evt)
|
java.awt.Color |
getBackground()
Return the background color of the component |
int |
getColorMode()
Return the color mode property |
double |
getDisplayHi()
Return display high |
double |
getDisplayLo()
Return display low |
java.awt.Font |
getFont()
Return the font of the text on the component |
java.awt.Color |
getForeground()
Return the foreground color of the component |
int |
getFrameWidth()
Return the frame width of component face |
int |
getLabelStyle()
Return the label style property |
int |
getRangeStyle()
Return the range style property |
void |
paint(java.awt.Graphics g)
Draw offscreen graphics and repaint it onto the screen. |
void |
setBackground(java.awt.Color newBg)
Set component background color |
void |
setBounds(int x,
int y,
int w,
int h)
Set the bounds of the canvas. |
void |
setBounds(java.awt.Rectangle r)
Set the bounds of the canvas. |
void |
setColorMode(int newColorMode)
Set the color mode property |
void |
setDisplayHi(double hi)
Set the display high. |
void |
setDisplayLo(double lo)
Set the display low. |
void |
setDisplayRange(double lo,
double hi)
Set the display limits. |
void |
setFont(java.awt.Font newFont)
Set text font for labeling and displaying values. |
void |
setForeground(java.awt.Color newFg)
Set compoenet foreground color |
void |
setFrameWidth(int pixels)
Set the frame width of component face |
void |
setLabelStyle(int newLab)
Set the label style property |
void |
setRangeStyle(int newRangeStyle)
Set the range style property |
void |
setSize(java.awt.Dimension d)
Set canvas size. |
void |
setSize(int newWidth,
int newHeight)
Set canvas size. |
void |
update(java.awt.Graphics g)
Overwrite the parent update method so it only call this.paint(g) |
Methods inherited from class adm.CCanvas |
getDeviceName,
getPropertyName,
setDeviceAndPropertyName,
setDeviceName,
setPropertyName |
Methods inherited from class java.awt.Canvas |
addNotify |
Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
addPropertyChangeListener,
addPropertyChangeListener,
bounds,
checkImage,
checkImage,
contains,
contains,
createImage,
createImage,
deliverEvent,
disable,
dispatchEvent,
doLayout,
enable,
enable,
enableInputMethods,
getAlignmentX,
getAlignmentY,
getBounds,
getBounds,
getColorModel,
getComponentAt,
getComponentAt,
getComponentOrientation,
getCursor,
getDropTarget,
getFontMetrics,
getGraphics,
getHeight,
getInputContext,
getInputMethodRequests,
getLocale,
getLocation,
getLocation,
getLocationOnScreen,
getMaximumSize,
getMinimumSize,
getName,
getParent,
getPeer,
getPreferredSize,
getSize,
getSize,
getToolkit,
getTreeLock,
getWidth,
getX,
getY,
gotFocus,
handleEvent,
hasFocus,
hide,
imageUpdate,
inside,
invalidate,
isDisplayable,
isDoubleBuffered,
isEnabled,
isFocusTraversable,
isLightweight,
isOpaque,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
layout,
list,
list,
list,
list,
list,
locate,
location,
lostFocus,
minimumSize,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
postEvent,
preferredSize,
prepareImage,
prepareImage,
print,
printAll,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
removeNotify,
removePropertyChangeListener,
removePropertyChangeListener,
repaint,
repaint,
repaint,
repaint,
requestFocus,
reshape,
resize,
resize,
setComponentOrientation,
setCursor,
setDropTarget,
setEnabled,
setLocale,
setLocation,
setLocation,
setName,
setVisible,
show,
show,
size,
toString,
transferFocus,
validate |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public CAnimatedCanvas()
public CAnimatedCanvas(java.lang.String dName, java.lang.String pName)
dName
- device namepName
- property namepublic CAnimatedCanvas(int width, int height)
width
- component widthheight
- component heightpublic CAnimatedCanvas(int width, int height, java.awt.Color fg, java.awt.Color bg)
width
- component widthheight
- component heightfg
- foreground colorbg
- background colorMethod Detail |
public void setSize(int newWidth, int newHeight)
newWidth
- width of the componentnewHeight
- height of the componentpublic void setSize(java.awt.Dimension d)
d
- dimension of the componentpublic void setBounds(int x, int y, int w, int h)
x
- component X locationy
- component Y locationw
- component widthh
- component heightpublic void setBounds(java.awt.Rectangle r)
r
- a rectange bounding box for componentpublic void setFont(java.awt.Font newFont)
newFont
- font for any text on the componentpublic java.awt.Font getFont()
public void setBackground(java.awt.Color newBg)
newBg
- the background color of componentpublic void setForeground(java.awt.Color newFg)
newFg
- the foreground color of componentpublic java.awt.Color getBackground()
public java.awt.Color getForeground()
public void setFrameWidth(int pixels)
pixels
- the pixels of the frame widthpublic int getFrameWidth()
public void setLabelStyle(int newLab)
newLab
- the new label style, which may be one of:
public int getLabelStyle()
public void setColorMode(int newColorMode)
newColorMode
- the new color mode, which may be one of:
public int getColorMode()
public void setRangeStyle(int newRangeStyle)
newRangeStyle
- the new range style, which may be one of:
public int getRangeStyle()
public void setDisplayRange(double lo, double hi)
lo
- the display lowhi
- the display high
hi must be larger than lo otherwise nothing is changed.public void setDisplayHi(double hi)
hi
- the display high
hi must be larger than displayLo otherwise nothing is changed.public void setDisplayLo(double lo)
lo
- the display low
lo must be smaller than displayHi otherwise nothing is changed.public double getDisplayHi()
public double getDisplayLo()
public final void update(java.awt.Graphics g)
public final void paint(java.awt.Graphics g)
public void deviceChanged(DeviceEvent evt)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |