issrg.pba.management.manager.gui
Class IntegerDocument

java.lang.Object
  extended by javax.swing.text.AbstractDocument
      extended by javax.swing.text.PlainDocument
          extended by issrg.pba.management.manager.gui.IntegerDocument
All Implemented Interfaces:
java.io.Serializable, javax.swing.text.Document

public class IntegerDocument
extends javax.swing.text.PlainDocument

A Document that will only accept integer characters.

PlainDocument implements javax.swing.text.Document, which is passed into an instance of JTextField when it is constructed.

When characters are typed into the field on the screen by the user, the insertString of this class is called, and this implementation will only allow Integers to be accepted.

Version:
0.1.2008.01.26
Author:
mfb4@kent.ac.uk
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.text.AbstractDocument
javax.swing.text.AbstractDocument.AbstractElement, javax.swing.text.AbstractDocument.AttributeContext, javax.swing.text.AbstractDocument.BranchElement, javax.swing.text.AbstractDocument.Content, javax.swing.text.AbstractDocument.DefaultDocumentEvent, javax.swing.text.AbstractDocument.ElementEdit, javax.swing.text.AbstractDocument.LeafElement
 
Field Summary
 
Fields inherited from class javax.swing.text.PlainDocument
lineLimitAttribute, tabSizeAttribute
 
Fields inherited from class javax.swing.text.AbstractDocument
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName
 
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
 
Constructor Summary
IntegerDocument()
          constructor.
 
Method Summary
 void insertString(int offset, java.lang.String insertString, javax.swing.text.AttributeSet a)
          The method that checks character by character that only integers are entered.
 
Methods inherited from class javax.swing.text.PlainDocument
createDefaultRoot, getDefaultRootElement, getParagraphElement, insertUpdate, removeUpdate
 
Methods inherited from class javax.swing.text.AbstractDocument
addDocumentListener, addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, postRemoveUpdate, putProperty, readLock, readUnlock, remove, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntegerDocument

public IntegerDocument()
constructor.

Since:
0.1.2008.01.26
Method Detail

insertString

public void insertString(int offset,
                         java.lang.String insertString,
                         javax.swing.text.AttributeSet a)
                  throws javax.swing.text.BadLocationException
The method that checks character by character that only integers are entered.

Specified by:
insertString in interface javax.swing.text.Document
Overrides:
insertString in class javax.swing.text.PlainDocument
Parameters:
offset - - the starting offset >= 0
insertString - - the string to insert; does nothing with null/empty strings
a - - the attributes for the inserted content
Throws:
javax.swing.text.BadLocationException - thrown by the the overridden super method.
Since:
0.1.2008.01.26
See Also:
PlainDocument