applications.cryptotoolj
Class TextAreaPlus

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.TextComponent
          extended by java.awt.TextArea
              extended by applications.cryptotoolj.TextAreaPlus
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.event.TextListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class TextAreaPlus
extends java.awt.TextArea
implements java.awt.event.TextListener, java.awt.event.FocusListener

This class implements a TextArea for CryptoToolJ. It manages the opening, closing, saving, and renaming of the file associated with the TextArea.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.awt.TextArea
SCROLLBARS_BOTH, SCROLLBARS_HORIZONTAL_ONLY, SCROLLBARS_NONE, SCROLLBARS_VERTICAL_ONLY
 
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
TextAreaPlus()
           
TextAreaPlus(java.awt.Frame parent, java.lang.String name, javax.swing.border.TitledBorder border)
           
 
Method Summary
 void focusGained(java.awt.event.FocusEvent e)
          focusGained changes the value of inFocus to true when the TextAreaPlus object becomes active.
 void focusLost(java.awt.event.FocusEvent e)
          focusLost changes the value of inFocus to false when the TextAreaPlus object is no longer active.
 java.io.File getFile()
           
 java.lang.String getText()
           
 boolean isDirty()
           
 boolean isInFocus()
           
 void markFileSaved()
           
 void openFile(java.lang.String encoding)
           
 boolean save(java.lang.String file_encoding, boolean rename)
           
 int saveToFile()
           
 void setFile(java.io.File f)
           
 void setText(java.lang.String s)
           
 void textValueChanged(java.awt.event.TextEvent e)
          This method is part of TextListener interface.
 
Methods inherited from class java.awt.TextArea
addNotify, append, appendText, getAccessibleContext, getColumns, getMinimumSize, getMinimumSize, getPreferredSize, getPreferredSize, getRows, getScrollbarVisibility, insert, insertText, minimumSize, minimumSize, preferredSize, preferredSize, replaceRange, replaceText, setColumns, setRows
 
Methods inherited from class java.awt.TextComponent
addTextListener, enableInputMethods, getBackground, getCaretPosition, getInputMethodRequests, getListeners, getSelectedText, getSelectionEnd, getSelectionStart, getTextListeners, isEditable, removeNotify, removeTextListener, select, selectAll, setBackground, setCaretPosition, setEditable, setSelectionEnd, setSelectionStart
 
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, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, 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, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextAreaPlus

public TextAreaPlus()

TextAreaPlus

public TextAreaPlus(java.awt.Frame parent,
                    java.lang.String name,
                    javax.swing.border.TitledBorder border)
Method Detail

setFile

public void setFile(java.io.File f)

openFile

public void openFile(java.lang.String encoding)

setText

public void setText(java.lang.String s)
Overrides:
setText in class java.awt.TextComponent

getText

public java.lang.String getText()
Overrides:
getText in class java.awt.TextComponent

saveToFile

public int saveToFile()

save

public boolean save(java.lang.String file_encoding,
                    boolean rename)

isDirty

public boolean isDirty()

markFileSaved

public void markFileSaved()

isInFocus

public boolean isInFocus()

getFile

public java.io.File getFile()

textValueChanged

public void textValueChanged(java.awt.event.TextEvent e)
This method is part of TextListener interface. It is called each time the text in a TextArea is changed.

Specified by:
textValueChanged in interface java.awt.event.TextListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
focusLost changes the value of inFocus to false when the TextAreaPlus object is no longer active. The color of titled border object is then set to black and the (Active) string is removed from the end of the title string, if it is there.

Specified by:
focusLost in interface java.awt.event.FocusListener

focusGained

public void focusGained(java.awt.event.FocusEvent e)
focusGained changes the value of inFocus to true when the TextAreaPlus object becomes active. The title of the titled border object is then set to green and an (Active) substring is then added to the end of the title string.

Specified by:
focusGained in interface java.awt.event.FocusListener