|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.text.JTextComponent javax.swing.JTextArea edu.northwestern.at.utils.swing.XTextArea
public class XTextArea
A JTextArea with different defaults and behavior.
The constructors are the same as in JTextArea. We did not bother giving them their own javadoc.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JTextArea |
---|
javax.swing.JTextArea.AccessibleJTextArea |
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent |
---|
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.DropLocation, javax.swing.text.JTextComponent.KeyBinding |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class javax.swing.text.JTextComponent |
---|
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY |
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 |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
XTextArea()
|
|
XTextArea(javax.swing.text.Document doc)
|
|
XTextArea(javax.swing.text.Document doc,
java.lang.String text,
int rows,
int columns)
|
|
XTextArea(int rows,
int columns)
|
|
XTextArea(java.lang.String text)
|
|
XTextArea(java.lang.String text,
int rows,
int columns)
|
Method Summary | |
---|---|
void |
clearSelection()
Clear selection. |
boolean |
clipboardHasPasteableData()
Check if clipboard has pasteable data. |
void |
copy()
Copy to clipboard. |
void |
cut()
Cut to clipboard. |
PrintableComponent |
getPrintableComponent(java.lang.String title,
java.awt.print.PageFormat pageFormat)
Return printable component. |
javax.swing.JScrollPane |
getScrollPane()
Attaches a scroll bar to the text area and returns the scroll pane. |
boolean |
isCopyEnabled()
Is copy enabled? |
boolean |
isCutEnabled()
Is cut enabled? |
boolean |
isPasteEnabled()
Is paste enabled? |
boolean |
isSelectAllEnabled()
Checks if "select all" enabled. |
boolean |
isTextSelected()
Is anything selected which can be cut/copied? |
boolean |
isUnselectEnabled()
Is unselect enabled? |
void |
paste()
Paste from clipboard. |
void |
printContents(java.lang.String title,
java.awt.print.PrinterJob printerJob,
java.awt.print.PageFormat pageFormat)
Prints the XTextArea contents. |
void |
saveToFile(java.lang.String fileName)
Save to a named file. |
void |
saveToFile(java.awt.Window parentWindow)
Save to a file using a file dialog. |
void |
scrollToBeginning()
Scrolls to the beginning of the document. |
void |
scrollToEnd()
Scrolls to the end of the document. |
void |
scrollToEndForSure()
Scrolls to the end of the document for sure. |
void |
selectAll()
Selects all text. |
void |
setTabsEnabled(boolean tabsEnabled)
Enables or disables tabs. |
void |
setText(java.lang.String t)
Sets the area text and resets the caret position to 0. |
void |
unselect()
Unselect selection. |
Methods inherited from class javax.swing.JTextArea |
---|
append, createDefaultModel, 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, 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, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDocument, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, 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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public XTextArea()
public XTextArea(javax.swing.text.Document doc)
public XTextArea(javax.swing.text.Document doc, java.lang.String text, int rows, int columns)
public XTextArea(int rows, int columns)
public XTextArea(java.lang.String text)
public XTextArea(java.lang.String text, int rows, int columns)
Method Detail |
---|
public javax.swing.JScrollPane getScrollPane()
The scroll bar policy is set to vertical scroll bar always and horizontal scroll bar never.
public void setTabsEnabled(boolean tabsEnabled)
When tabs are enabled they are entered as regular characters into the text in the field. When they are disabled a tab advances to the next focus component. Tabs are disabled by default.
tabsEnabled
- True to enable tabs. public void setText(java.lang.String t)
setText
in class javax.swing.text.JTextComponent
t
- The new text for the area. public void printContents(java.lang.String title, java.awt.print.PrinterJob printerJob, java.awt.print.PageFormat pageFormat)
title
- Title for output.printerJob
- The printer job.pageFormat
- The printer page format. public PrintableComponent getPrintableComponent(java.lang.String title, java.awt.print.PageFormat pageFormat)
getPrintableComponent
in interface PrintableContents
title
- Title for printing.pageFormat
- Page format for printing.
public void scrollToBeginning()
public void scrollToEnd()
public void scrollToEndForSure()
The Swing text package is very ornery when it comes to programmatic scrolling. This "for sure" method starts a thread that wakes up every tenth of a second for two seconds and makes sure that the text pane is scrolled to the end.
public boolean clipboardHasPasteableData()
clipboardHasPasteableData
in interface ClipboardHasPasteableData
public void clearSelection()
public void cut()
cut
in interface CutCopyPaste
cut
in class javax.swing.text.JTextComponent
public void copy()
copy
in interface CutCopyPaste
copy
in class javax.swing.text.JTextComponent
public void paste()
paste
in interface CutCopyPaste
paste
in class javax.swing.text.JTextComponent
public boolean isCutEnabled()
isCutEnabled
in interface CutCopyPaste
public boolean isCopyEnabled()
isCopyEnabled
in interface CutCopyPaste
public boolean isPasteEnabled()
isPasteEnabled
in interface CutCopyPaste
public boolean isTextSelected()
isTextSelected
in interface CutCopyPaste
public void saveToFile(java.lang.String fileName)
saveToFile
in interface SaveToFile
fileName
- Name of file to which to save results. public void saveToFile(java.awt.Window parentWindow)
saveToFile
in interface SaveToFile
parentWindow
- Parent window for file dialog.
Runs a file dialog to get the name of the file to which to save results.
public void selectAll()
selectAll
in interface SelectAll
selectAll
in class javax.swing.text.JTextComponent
public boolean isSelectAllEnabled()
isSelectAllEnabled
in interface SelectAll
public void unselect()
unselect
in interface SelectAll
public boolean isUnselectEnabled()
isUnselectEnabled
in interface SelectAll
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |