ach
Class IconButton

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Canvas
          extended byach.IconButton
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class IconButton
extends java.awt.Canvas

IconButton.java (compatible to JDK 1.0.x)
Copyright (c) 2004 Helge Hackbarth, All Rights Reserved.
IconButton is an extension of class Canvas that behaves similar to the JButton of JFC/Swing without the need to include that library. It can be used as toggle (two state) button as well.

THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THE AUTHOR SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
IconButton(java.lang.String imgName)
          Constructor
IconButton(java.lang.String imgName, java.lang.String toolTipText)
          Constructor
 
Method Summary
 void disable()
          Disable button
 void enable()
          enable button
 java.awt.Dimension getMinimumSize()
           
 java.awt.Dimension getPreferredSize()
           
 boolean getToggleMode()
          get toggle (two state) mode
 boolean getToggleState()
          get toggle state (true means button is selected (pushed down))
 boolean handleEvent(java.awt.Event evt)
           
 boolean isEnabled()
           
 void mapComponent(java.awt.Component c)
          Map another component to this button in order to be controlled together with IconButon methods.
 java.awt.Dimension minimumSize()
           
 void paint(java.awt.Graphics g)
           
 java.awt.Dimension preferredSize()
           
 void setEnabled(boolean enabledFlag)
          Set enabled state of button
 void setIcon(java.lang.String imgName)
          Set icon image
 void setToggleMode(boolean b)
          set toggle (two state) mode
 void setToggleState(boolean b)
          set toggle state
 void setToolTipText(java.lang.String text)
          Set tooltip text to be displayed when mouse moves over button
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disableEvents, dispatchEvent, doLayout, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, 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, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IconButton

public IconButton(java.lang.String imgName)
Constructor

Parameters:
imgName - String representing the path to the image (if imageName == null it will look like a seperator)

IconButton

public IconButton(java.lang.String imgName,
                  java.lang.String toolTipText)
Constructor

Parameters:
imgName - String representing the path to the image (if imageName == null it will look like a seperator)
toolTipText - String that should be displayed when mouse moves over button
Method Detail

mapComponent

public void mapComponent(java.awt.Component c)
Map another component to this button in order to be controlled together with IconButon methods. Currently used to control selected state of a JToggleButton when method setToggleState is called.

Parameters:
c - the component to be controlled together with this button

setIcon

public void setIcon(java.lang.String imgName)
Set icon image

Parameters:
imgName - String representing the path to the image

setEnabled

public void setEnabled(boolean enabledFlag)
Set enabled state of button

Parameters:
enabledFlag - true if button is enabled

disable

public void disable()
Disable button


enable

public void enable()
enable button


isEnabled

public boolean isEnabled()

setToggleMode

public void setToggleMode(boolean b)
set toggle (two state) mode

Parameters:
b - true sets button to two state mode

getToggleMode

public boolean getToggleMode()
get toggle (two state) mode


setToggleState

public void setToggleState(boolean b)
set toggle state

Parameters:
b - true sets button to selected (pushed down) mode

getToggleState

public boolean getToggleState()
get toggle state (true means button is selected (pushed down))


setToolTipText

public void setToolTipText(java.lang.String text)
Set tooltip text to be displayed when mouse moves over button


minimumSize

public java.awt.Dimension minimumSize()

getMinimumSize

public java.awt.Dimension getMinimumSize()

preferredSize

public java.awt.Dimension preferredSize()

getPreferredSize

public java.awt.Dimension getPreferredSize()

paint

public void paint(java.awt.Graphics g)

handleEvent

public boolean handleEvent(java.awt.Event evt)