kiwi.ui
Class SimpleEditor

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--kiwi.ui.KPanel
                                |
                                +--kiwi.ui.SimpleEditor

public class SimpleEditor
extends KPanel

A simple text editor for entering unformatted text. The editor consists of a scrollable JTextArea and Cut, Copy, and Paste buttons.


An example SimpleEditor.

Version:
1.0 (11/98)
Author:
Mark Lindner, PING Software Group
See Also:
SimpleStyledEditor, Serialized Form

Inner classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Field Summary
protected  JTextArea t_text
          The JTextArea that holds the text for this component.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
SimpleEditor()
          Construct a new SimpleEditor.
SimpleEditor(int rows, int columns)
          Construct a new SimpleEditor with the specified number of rows and colunns.
 
Method Summary
 void addButton(KButton button)
          Add a button to the editor's tool bar.
 void copy()
          Perform a copy operation on the editor.
 void cut()
          Perform a cut operation on the editor.
 JTextArea getJTextArea()
          Get the JTextArea used by this SimpleEditor.
 String getText()
          Get the text in the editor.
 void insertText(String text)
          Insert text into the editor, replacing the current selection (if any).
 void paste()
          Perform a paste operation on the editor.
 void requestFocus()
          Request focus for the editor.
 void setEditable(boolean flag)
          Set the editable state of the editor.
 void setText(String text)
          Set the text in the editor.
 
Methods inherited from class kiwi.ui.KPanel
getComponentByName, paintComponent, setOpaque, setTexture
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

t_text

protected JTextArea t_text
The JTextArea that holds the text for this component.
Constructor Detail

SimpleEditor

public SimpleEditor()
Construct a new SimpleEditor. The editor is created with a default JTextArea size of 10 rows by 60 columns.

SimpleEditor

public SimpleEditor(int rows,
                    int columns)
Construct a new SimpleEditor with the specified number of rows and colunns.
Parameters:
row - The number of rows for the JTextArea.
columns - The number of columns for the JTextArea.
Method Detail

requestFocus

public void requestFocus()
Request focus for the editor.
Overrides:
requestFocus in class JComponent

getJTextArea

public JTextArea getJTextArea()
Get the JTextArea used by this SimpleEditor.
Returns:
The JTextArea for this editor.

insertText

public void insertText(String text)
Insert text into the editor, replacing the current selection (if any).
Parameters:
text - The text to insert.

setEditable

public void setEditable(boolean flag)
Set the editable state of the editor.
Parameters:
flag - If true, the editor will be editable, otherwise it will be non-editable.

setText

public void setText(String text)
Set the text in the editor.
Parameters:
text - The text to display in the editor.

getText

public String getText()
Get the text in the editor.
Returns:
The text currently in the editor.

cut

public void cut()
Perform a cut operation on the editor. Removes the selected text from the editor, and stores it in the system clipboard.

copy

public void copy()
Perform a copy operation on the editor. Copies the selected text from the editor to the system clipboard.

paste

public void paste()
Perform a paste operation on the editor. Inserts text from the system clipboard into the editor.

addButton

public void addButton(KButton button)
Add a button to the editor's tool bar. The button is added to the right of the last button in the toolbar. This method does not register this editor as an ActionListener for the button.
Parameters:
button - The button to add.