com.tecnick.jadc
Class DisplayPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by com.tecnick.jadc.DisplayPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class DisplayPanel
extends java.awt.Panel

Title: DisplayPanel Class

Description: Class to create digital display


Copyright (c) 2002-2006 Tecnick.com S.r.l (www.tecnick.com) Via Ugo Foscolo n.19 - 09045 Quartu Sant'Elena (CA) - ITALY - www.tecnick.com - info@tecnick.com
Project homepage: http://jxhtmledit.sourceforge.net
License: http://www.gnu.org/copyleft/gpl.html GPL 2

Version:
1.0.007
Author:
Nicola Asuni [www.tecnick.com].
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  int bh
          background image height
private  java.awt.Graphics bufferGraphics
          graphics for double buffering
private  int bw
          background image width
private  int bx
          background image X start coordinate
private  int by
          background image Y start coordinate
private  java.lang.String current_info
          current string to display
private  int dh
          digits height
private  java.awt.Image[] dig
          digit images
private  java.awt.Image[] display_digits
          images to display in order.
private  int dw
          digits width
private  int dx
          digits X start coordinate
private  int dy
          digits Y start coordinate
private  int h
          total display height
private  java.awt.Image img_bg
          background image
private  int num_digits
          number of display digits
private  java.awt.Image offscreen
          offscreen image to handle double buffering
private static long serialVersionUID
          serialVersionUID
private  int w
          total display width
 
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
DisplayPanel()
          Build a void panel.
DisplayPanel(int numdig, java.lang.String info, java.awt.Image image, java.awt.Image[] dimg, int aw, int ah)
          Build a display panel.
 
Method Summary
 void addNotify()
          Creates the Panel's peer.
 void paint(java.awt.Graphics g)
          draw button elements (border, image and label) at calculated positions
protected  void paintImage(java.awt.Graphics gbuffer, java.awt.Image img, int x, int y)
          Paint image at specified position
 void resize()
          Resize the display
 void setBackgroundImage(java.awt.Image image)
          Set the display background
 void setDigitsImages(java.awt.Image[] images)
          Set the display digits
 void setInfo(java.lang.String info)
          Set string to display
 void setNumDigits(int numdig)
          Set number of display digits
 void update(java.awt.Graphics g)
          overwrite update method for double buffering
 
Methods inherited from class java.awt.Panel
getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
serialVersionUID

See Also:
Constant Field Values

bufferGraphics

private java.awt.Graphics bufferGraphics
graphics for double buffering


offscreen

private java.awt.Image offscreen
offscreen image to handle double buffering


img_bg

private java.awt.Image img_bg
background image


dig

private java.awt.Image[] dig
digit images


display_digits

private java.awt.Image[] display_digits
images to display in order.


current_info

private java.lang.String current_info
current string to display


num_digits

private int num_digits
number of display digits


w

private int w
total display width


h

private int h
total display height


dw

private int dw
digits width


dh

private int dh
digits height


dx

private int dx
digits X start coordinate


dy

private int dy
digits Y start coordinate


bw

private int bw
background image width


bh

private int bh
background image height


bx

private int bx
background image X start coordinate


by

private int by
background image Y start coordinate

Constructor Detail

DisplayPanel

public DisplayPanel()
Build a void panel.


DisplayPanel

public DisplayPanel(int numdig,
                    java.lang.String info,
                    java.awt.Image image,
                    java.awt.Image[] dimg,
                    int aw,
                    int ah)
Build a display panel.

Parameters:
numdig - number of display digits
info - string to display
image - background image
dimg - array of digits images
aw - applet width
ah - applet height
Method Detail

update

public void update(java.awt.Graphics g)
overwrite update method for double buffering

Overrides:
update in class java.awt.Container
Parameters:
g - graphics

setInfo

public void setInfo(java.lang.String info)
Set string to display

Parameters:
info - string to display

setBackgroundImage

public void setBackgroundImage(java.awt.Image image)
Set the display background

Parameters:
image - background image

setNumDigits

public void setNumDigits(int numdig)
Set number of display digits

Parameters:
numdig - number of digits on display

setDigitsImages

public void setDigitsImages(java.awt.Image[] images)
Set the display digits

Parameters:
images - array of digits images

addNotify

public void addNotify()
Creates the Panel's peer. The peer allows you to modify the appearance of the panel without changing its functionality.

Overrides:
addNotify in class java.awt.Panel

resize

public void resize()
Resize the display


paintImage

protected void paintImage(java.awt.Graphics gbuffer,
                          java.awt.Image img,
                          int x,
                          int y)
Paint image at specified position

Parameters:
gbuffer - graphic context
img - image to paint
x - X coordinate
y - Y coordinate

paint

public void paint(java.awt.Graphics g)
draw button elements (border, image and label) at calculated positions

Overrides:
paint in class java.awt.Container
Parameters:
g - the graphic area when diplay button elements