hades.gui
Class HexTextField

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Canvas
          extended byhades.gui.HexTextField
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.event.KeyListener, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable

public class HexTextField
extends java.awt.Canvas
implements java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener

HexTextField - an interactive TextField to display and edit hexadecimal numbers, like register-contents.

The following list describes the editing functions of HexTextField:

Add your own objects as ActionListeners for all value changes on a HexTextField by calling HexTextField.addActionListener(). The ActionEvents generated by HexTextField contain a String with the current value as their argument. Call getValue() and setValue() to retrieve and set the numerical value managed by HexTextField directly.

Note that HexTextField currently uses class java.lang.Long to parse hexadecimal numbers, which are therefore assumed to be signed. This may lead to surprising behaviour when tried on 64-bit registers, but it should work ok with registers from 1 to 63 bits. Please complain to Javasoft that we do need unsigned integers after all...

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
protected  java.util.Hashtable actionListenerTable
           
protected  java.awt.Color backgroundColor
           
protected  int baseline
           
protected  int border_height
           
protected  int border_width
           
protected  int char_height
           
protected  int char_width
           
protected  int height
           
protected  java.awt.Color highlightColor
           
protected  int n_chars
           
protected  int n_cursor
           
protected  java.awt.Image offscreenBuffer
           
protected  boolean shiftMode
           
protected  java.lang.String svalue
           
protected  java.awt.Color textColor
           
protected  java.awt.Font textFont
           
protected  long value
           
protected  int 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
HexTextField(int n_chars)
           
 
Method Summary
 void addActionListener(java.awt.event.ActionListener AL)
           
protected  void createOffscreenBuffer()
           
 void decrementValue()
           
protected  java.lang.String getHexString()
           
 java.awt.Dimension getMinimumSize()
           
 java.awt.Dimension getPreferredSize()
           
 java.awt.Font getTextFont()
           
protected  long getValue()
           
 void incrementValue()
           
 void insertDigitAtMousePosition(char c)
          insert char c at the current cursor postion, then move the cursor to the right.
static boolean isHexDigit(char c)
           
 void keyPressed(java.awt.event.KeyEvent ke)
           
 void keyReleased(java.awt.event.KeyEvent ke)
           
 void keyTyped(java.awt.event.KeyEvent ke)
           
static void main(java.lang.String[] argv)
           
 void mouseClicked(java.awt.event.MouseEvent me)
           
 void mouseDragged(java.awt.event.MouseEvent me)
           
 void mouseEntered(java.awt.event.MouseEvent me)
           
 void mouseExited(java.awt.event.MouseEvent me)
           
 void mouseMoved(java.awt.event.MouseEvent me)
           
 void mousePressed(java.awt.event.MouseEvent me)
           
 void mouseReleased(java.awt.event.MouseEvent me)
           
 void moveCursorLeft()
           
 void moveCursorRight()
           
static void msg(java.lang.String msg)
           
protected  void notifyListeners()
           
 void paint(java.awt.Graphics g)
           
protected  void prepareGUI()
           
 void removeActionListener(java.awt.event.ActionListener AL)
           
 void setCursorFromMousePosition(java.awt.event.MouseEvent me)
           
 void setDigitAtMousePosition(char c)
           
 void setTextFont(java.awt.Font f)
           
protected  void setValue(long value)
           
 
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, disable, disableEvents, dispatchEvent, doLayout, enable, 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, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, 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, paramString, postEvent, preferredSize, 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, setEnabled, 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
 

Field Detail

value

protected long value

svalue

protected java.lang.String svalue

actionListenerTable

protected java.util.Hashtable actionListenerTable

textFont

protected java.awt.Font textFont

backgroundColor

protected java.awt.Color backgroundColor

textColor

protected java.awt.Color textColor

highlightColor

protected java.awt.Color highlightColor

offscreenBuffer

protected java.awt.Image offscreenBuffer

n_chars

protected int n_chars

n_cursor

protected int n_cursor

char_width

protected int char_width

char_height

protected int char_height

baseline

protected int baseline

border_width

protected int border_width

border_height

protected int border_height

width

protected int width

height

protected int height

shiftMode

protected boolean shiftMode
Constructor Detail

HexTextField

public HexTextField(int n_chars)
Method Detail

getValue

protected long getValue()

setValue

protected void setValue(long value)

notifyListeners

protected void notifyListeners()

addActionListener

public void addActionListener(java.awt.event.ActionListener AL)

removeActionListener

public void removeActionListener(java.awt.event.ActionListener AL)

getHexString

protected java.lang.String getHexString()

prepareGUI

protected void prepareGUI()

setTextFont

public void setTextFont(java.awt.Font f)

getTextFont

public java.awt.Font getTextFont()

createOffscreenBuffer

protected void createOffscreenBuffer()

paint

public void paint(java.awt.Graphics g)

getMinimumSize

public java.awt.Dimension getMinimumSize()

getPreferredSize

public java.awt.Dimension getPreferredSize()

setCursorFromMousePosition

public void setCursorFromMousePosition(java.awt.event.MouseEvent me)

moveCursorRight

public void moveCursorRight()

moveCursorLeft

public void moveCursorLeft()

incrementValue

public void incrementValue()

decrementValue

public void decrementValue()

setDigitAtMousePosition

public void setDigitAtMousePosition(char c)

insertDigitAtMousePosition

public void insertDigitAtMousePosition(char c)
insert char c at the current cursor postion, then move the cursor to the right. If the cursor is at the rightmost position, we begin to shift the current value to the left.


isHexDigit

public static boolean isHexDigit(char c)

mousePressed

public void mousePressed(java.awt.event.MouseEvent me)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent me)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent me)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent me)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent me)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent me)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent me)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent ke)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent ke)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent ke)
Specified by:
keyTyped in interface java.awt.event.KeyListener

msg

public static void msg(java.lang.String msg)

main

public static void main(java.lang.String[] argv)