|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--sunw.demo.buttons.OurButton
A simple Java Beans button. OurButton is a "from-scratch" lightweight AWT component. It's a good example of how to implement bound properties and support for event listeners. Parts of the source are derived from sun.awt.tiny.TinyButtonPeer.
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Constructor Summary | |
OurButton()
Constructs a Button with the a default label. |
|
OurButton(java.lang.String label)
Constructs a Button with the specified label. |
Method Summary | |
void |
addActionListener(java.awt.event.ActionListener l)
The specified ActionListeners actionPerformed method will be called each time the button is clicked. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l)
The specified PropertyChangeListeners propertyChange method will be called each time the value of any bound property is changed. |
void |
fireAction()
This method has the same effect as pressing the button. |
boolean |
getDebug()
Returns true if debugging output is enabled. |
int |
getFontSize()
Return the current font point size. |
java.lang.String |
getLabel()
Returns the buttons label. |
java.awt.Dimension |
getMinimumSize()
|
java.awt.Dimension |
getPreferredSize()
|
boolean |
isLargeFont()
Returns true if the font is "large" in the sense defined by setLargeFont. |
java.awt.Dimension |
minimumSize()
Deprecated. provided for backward compatibility with old layout managers. |
void |
mouseClicked(java.awt.event.MouseEvent evt)
|
void |
mouseDragged(java.awt.event.MouseEvent evt)
|
void |
mouseEntered(java.awt.event.MouseEvent evt)
|
void |
mouseExited(java.awt.event.MouseEvent evt)
|
void |
mouseMoved(java.awt.event.MouseEvent evt)
|
void |
mousePressed(java.awt.event.MouseEvent evt)
|
void |
mouseReleased(java.awt.event.MouseEvent evt)
|
void |
paint(java.awt.Graphics g)
Paint the button: the label is centered in both dimensions. |
java.awt.Dimension |
preferredSize()
Deprecated. provided for backward compatibility with old layout managers. |
void |
removeActionListener(java.awt.event.ActionListener l)
Remove this ActionListener from the buttons internal list. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l)
Remove this PropertyChangeListener from the buttons internal list. |
void |
setBackground(java.awt.Color c)
Set the color the buttons background is drawn with. |
void |
setDebug(boolean x)
Enable debugging output. |
void |
setFont(java.awt.Font f)
Set the current font and change its size to fit. |
void |
setFontSize(int x)
Set the point size of the current font. |
void |
setForeground(java.awt.Color c)
Set the color the buttons label is drawn with. |
void |
setLabel(java.lang.String newLabel)
Set the buttons label and change it's size to fit. |
void |
setLargeFont(boolean b)
Set the font size to 18 if true, 12 otherwise. |
Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
addNotify,
addPropertyChangeListener,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
contains,
createImage,
createImage,
deliverEvent,
disable,
disableEvents,
dispatchEvent,
doLayout,
enable,
enable,
enableEvents,
enableInputMethods,
firePropertyChange,
getAlignmentX,
getAlignmentY,
getBackground,
getBounds,
getBounds,
getColorModel,
getComponentAt,
getComponentAt,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getGraphics,
getHeight,
getInputContext,
getInputMethodRequests,
getLocale,
getLocation,
getLocation,
getLocationOnScreen,
getMaximumSize,
getName,
getParent,
getPeer,
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,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
paramString,
postEvent,
prepareImage,
prepareImage,
print,
printAll,
processComponentEvent,
processEvent,
processFocusEvent,
processInputMethodEvent,
processKeyEvent,
processMouseEvent,
processMouseMotionEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
removeNotify,
removePropertyChangeListener,
repaint,
repaint,
repaint,
repaint,
requestFocus,
reshape,
resize,
resize,
setBounds,
setBounds,
setComponentOrientation,
setCursor,
setDropTarget,
setEnabled,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
setVisible,
show,
show,
size,
toString,
transferFocus,
update,
validate |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public OurButton()
public OurButton(java.lang.String label)
label
- the label of the buttonMethod Detail |
public void paint(java.awt.Graphics g)
public void mouseClicked(java.awt.event.MouseEvent evt)
public void mousePressed(java.awt.event.MouseEvent evt)
public void mouseReleased(java.awt.event.MouseEvent evt)
public void mouseEntered(java.awt.event.MouseEvent evt)
public void mouseExited(java.awt.event.MouseEvent evt)
public void mouseDragged(java.awt.event.MouseEvent evt)
public void mouseMoved(java.awt.event.MouseEvent evt)
public void addActionListener(java.awt.event.ActionListener l)
l
- the ActionListenerremoveActionListener(java.awt.event.ActionListener)
public void removeActionListener(java.awt.event.ActionListener l)
l
- the ActionListeneraddActionListener(java.awt.event.ActionListener)
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
l
- the PropertyChangeListenerremovePropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
l
- the PropertyChangeListeneraddPropertyChangeListener(java.beans.PropertyChangeListener)
public void fireAction()
addActionListener(java.awt.event.ActionListener)
public void setDebug(boolean x)
getDebug()
,
addPropertyChangeListener(java.beans.PropertyChangeListener)
public boolean getDebug()
setDebug(boolean)
public void setLargeFont(boolean b)
isLargeFont()
,
addPropertyChangeListener(java.beans.PropertyChangeListener)
public boolean isLargeFont()
setLargeFont(boolean)
,
setFont(java.awt.Font)
public void setFontSize(int x)
getFontSize()
,
setFont(java.awt.Font)
,
setLargeFont(boolean)
,
addPropertyChangeListener(java.beans.PropertyChangeListener)
public int getFontSize()
setFontSize(int)
public void setFont(java.awt.Font f)
setFontSize(int)
,
setLargeFont(boolean)
public void setLabel(java.lang.String newLabel)
getLabel()
public java.lang.String getLabel()
setLabel(java.lang.String)
public java.awt.Dimension getPreferredSize()
public java.awt.Dimension preferredSize()
public java.awt.Dimension getMinimumSize()
public java.awt.Dimension minimumSize()
public void setForeground(java.awt.Color c)
public void setBackground(java.awt.Color c)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |