All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants
Direct Known Subclasses:
StaticDigit, ValueDigit

public abstract class Digit extends SimpleButton
An extension of SimpleButton displaying one digit (character).
Version:
$id$
Author:
Jernej Kamenik
See Also:
  • Constructor Details

    • Digit

      protected Digit()
      Constructor for Digit creates an empty Digit.
  • Method Details

    • setEnhanced

      public void setEnhanced(boolean newEnhanced)
      Sets the enhancment mode of the Digit. When enhanced, the digit is painted using anti-aliasing rendering hints.
      Overrides:
      setEnhanced in class ResizableTextLabel
      Parameters:
      newEnhanced -
    • isEnhanced

      public boolean isEnhanced()
      Checks whether the Digit is enhanced.
      Overrides:
      isEnhanced in class ResizableTextLabel
      Returns:
      boolean
    • setSelected

      public void setSelected(boolean newSelected)
      Sets or removes the selection from the Digit.
      Parameters:
      newSelected -
    • isSelected

      public boolean isSelected()
      Checks for selection of the Digit.
      Returns:
      true if the Digit is selected, false otherwise.
    • setText

      public void setText(String newText)
      This method has been overriden to implement animated transitions between displayed text images. It sets the new text and starts the animation of the transition (if it is not already running).
      Overrides:
      setText in class ResizableTextLabel
      Parameters:
      newText - to be displayed.
      See Also:
      • JLabel#setText(java.lang.String)
    • setTilting

      public void setTilting(boolean tilting)
      Sets the tilting.
      Parameters:
      tilting - The tilting to set
    • isTilting

      public boolean isTilting()
      Returns the tilting.
      Returns:
      boolean
    • paintComponent

      public void paintComponent(Graphics g)
      This method was overriden to implement enhanced anti-aliasing display features as well as animated transitions.
      Overrides:
      paintComponent in class SimpleButton
      Parameters:
      g - DOCUMENT ME!
      See Also:
    • paintDigitTransition

      protected void paintDigitTransition(BufferedImage oldImage, BufferedImage newImage, Graphics g, float parameter)
      The method combines two images and paints them onto the selected Graphics object based on the value of parameter between 0 and 1.f. When parameter equals 0, oldImage should be painted completely and newImage not at all, and opposite when parameter equals 1.f. Descendants of Digit should override this method to implement different types of image transitions.
      Parameters:
      oldImage -
      newImage -
      g - Graphics object on which to paint the two images.
      parameter - float value between 0 and 1.f.