com.myjavaworld.gui
Class MTextArea
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.text.JTextComponent
javax.swing.JTextArea
com.myjavaworld.gui.MTextArea
- All Implemented Interfaces:
- MTextComponent, MouseListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, Scrollable
public class MTextArea
- extends JTextArea
- implements MTextComponent, MouseListener
An extension of javax.swing.MTextArea
.
- Version:
- 1.0
- Author:
- Sai Pullabhotla, psai [at] jMethods [dot] com
- See Also:
- Serialized Form
Constructor Summary |
MTextArea()
Creates an instance of MTextArea . |
MTextArea(int rows,
int columns)
Creates an instance of MTextArea . |
Method Summary |
boolean |
canCopy()
Checks to see if text can be copied from this text component. |
boolean |
canCut()
Checks to see if text can be cut from this text component. |
boolean |
canDelete()
Checks to see if text can be deleted from this text component. |
boolean |
canPaste()
Checks to see if text can be pasted in to this text component. |
boolean |
canRedo()
Checks to see if the changes made to this component can be redone. |
boolean |
canSelectAll()
Checks to see if whole text in this component can be selected. |
boolean |
canUndo()
Cecks to see if the changes made to this text component can be undone. |
protected Document |
createDefaultModel()
|
void |
delete()
Deletes the selected text from this text component. |
int |
getCharacterCase()
Gets the current chatacter case in use by this text component. |
int |
getMaximumLength()
Returns the maximum number of characters allowed in this text component. |
int |
getUndoLimit()
Returns the current undo/redo limit of this text component. |
void |
mouseClicked(MouseEvent evt)
|
void |
mouseEntered(MouseEvent evt)
|
void |
mouseExited(MouseEvent evt)
|
void |
mousePressed(MouseEvent evt)
|
void |
mouseReleased(MouseEvent evt)
|
void |
redo()
Redo the changes to this text component. |
void |
setCharacterCase(int characterCase)
Sets the character case to the given characterCase . |
void |
setMaximumLength(int maximumLength)
Sets the maxumum number of characters allowed in this text component to
the given value, maximumLength . |
void |
setUndoLimit(int undoLimit)
Sets the undo/redo limit to the given limit . |
void |
undo()
Undo the changes made to this text component. |
Methods inherited from class javax.swing.JTextArea |
append, getAccessibleContext, getColumns, getColumnWidth, getLineCount, getLineEndOffset, getLineOfOffset, getLineStartOffset, getLineWrap, getPreferredScrollableViewportSize, getPreferredSize, getRowHeight, getRows, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getTabSize, getUIClassID, getWrapStyleWord, insert, paramString, replaceRange, setColumns, setFont, setLineWrap, setRows, setTabSize, setWrapStyleWord |
Methods inherited from class javax.swing.text.JTextComponent |
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPrintable, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDocument, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, setUI, updateUI, viewToModel, write |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
MTextArea
public MTextArea()
- Creates an instance of
MTextArea
.
MTextArea
public MTextArea(int rows,
int columns)
- Creates an instance of
MTextArea
.
- Parameters:
rows
- Display heightcolumns
- display width
setMaximumLength
public void setMaximumLength(int maximumLength)
- Description copied from interface:
MTextComponent
- Sets the maxumum number of characters allowed in this text component to
the given value,
maximumLength
.
- Specified by:
setMaximumLength
in interface MTextComponent
- Parameters:
maximumLength
- Maximum length to set.
getMaximumLength
public int getMaximumLength()
- Description copied from interface:
MTextComponent
- Returns the maximum number of characters allowed in this text component.
- Specified by:
getMaximumLength
in interface MTextComponent
- Returns:
- maximum length
setCharacterCase
public void setCharacterCase(int characterCase)
- Description copied from interface:
MTextComponent
- Sets the character case to the given
characterCase
.
- Specified by:
setCharacterCase
in interface MTextComponent
- Parameters:
characterCase
- Character case to set for this text component.
getCharacterCase
public int getCharacterCase()
- Description copied from interface:
MTextComponent
- Gets the current chatacter case in use by this text component.
- Specified by:
getCharacterCase
in interface MTextComponent
- Returns:
- character case.
setUndoLimit
public void setUndoLimit(int undoLimit)
- Description copied from interface:
MTextComponent
- Sets the undo/redo limit to the given
limit
.
- Specified by:
setUndoLimit
in interface MTextComponent
- Parameters:
undoLimit
- Number of changes to be recorded by the undo/redo manager.
getUndoLimit
public int getUndoLimit()
- Description copied from interface:
MTextComponent
- Returns the current undo/redo limit of this text component.
- Specified by:
getUndoLimit
in interface MTextComponent
- Returns:
- Undo/Redo limit.
delete
public void delete()
- Description copied from interface:
MTextComponent
- Deletes the selected text from this text component.
- Specified by:
delete
in interface MTextComponent
undo
public void undo()
throws CannotUndoException
- Description copied from interface:
MTextComponent
- Undo the changes made to this text component.
- Specified by:
undo
in interface MTextComponent
- Throws:
CannotUndoException
redo
public void redo()
throws CannotRedoException
- Description copied from interface:
MTextComponent
- Redo the changes to this text component.
- Specified by:
redo
in interface MTextComponent
- Throws:
CannotRedoException
canCut
public boolean canCut()
- Description copied from interface:
MTextComponent
- Checks to see if text can be cut from this text component.
- Specified by:
canCut
in interface MTextComponent
- Returns:
true
If the text can be cut from this text component.
false
, otherwise.
canCopy
public boolean canCopy()
- Description copied from interface:
MTextComponent
- Checks to see if text can be copied from this text component.
- Specified by:
canCopy
in interface MTextComponent
- Returns:
true
, if text is copiable. false
,
otherwise.
canPaste
public boolean canPaste()
- Description copied from interface:
MTextComponent
- Checks to see if text can be pasted in to this text component.
- Specified by:
canPaste
in interface MTextComponent
- Returns:
true
, if text is pastable. false
,
otherwise.
canDelete
public boolean canDelete()
- Description copied from interface:
MTextComponent
- Checks to see if text can be deleted from this text component.
return
true
, if text can be deleted from this text
component. false
, otherwise.
- Specified by:
canDelete
in interface MTextComponent
canSelectAll
public boolean canSelectAll()
- Description copied from interface:
MTextComponent
- Checks to see if whole text in this component can be selected.
- Specified by:
canSelectAll
in interface MTextComponent
- Returns:
true
, if the text is selectable. false
,
otherwise.
canUndo
public boolean canUndo()
- Description copied from interface:
MTextComponent
- Cecks to see if the changes made to this text component can be undone.
- Specified by:
canUndo
in interface MTextComponent
- Returns:
true
, if the changes can be undone.
false
, otherwise.
canRedo
public boolean canRedo()
- Description copied from interface:
MTextComponent
- Checks to see if the changes made to this component can be redone.
- Specified by:
canRedo
in interface MTextComponent
- Returns:
true
, if the changes can be redone.
false, otherwise.
mouseEntered
public void mouseEntered(MouseEvent evt)
- Specified by:
mouseEntered
in interface MouseListener
mouseExited
public void mouseExited(MouseEvent evt)
- Specified by:
mouseExited
in interface MouseListener
mousePressed
public void mousePressed(MouseEvent evt)
- Specified by:
mousePressed
in interface MouseListener
mouseReleased
public void mouseReleased(MouseEvent evt)
- Specified by:
mouseReleased
in interface MouseListener
mouseClicked
public void mouseClicked(MouseEvent evt)
- Specified by:
mouseClicked
in interface MouseListener
createDefaultModel
protected Document createDefaultModel()
- Overrides:
createDefaultModel
in class JTextArea
Copyright © 2000-2012 jMethods, Inc.. All Rights Reserved.