| javax.swing.JComponent javax.swing.JPanel com.ibm.richtext.textpanel.JTextPanel
JTextPanel | final public class JTextPanel extends JPanel implements MTextPanel(Code) | | JTextPanel is an implementation of MTextPanel in a Swing JPanel.
See Also: MTextPanel |
Method Summary | |
public void | addListener(TextPanelListener listener) Add the given TextPanelListener to the listeners which will
receive update notifications from this JTextPanel. | public void | append(MConstText newText) Append the given text to the end of the document. | public boolean | canRedo() Return true if there is a change which can be redone. | public boolean | canUndo() Return true if there is a change which can be undone. | public void | clear() Remove selected text from the document, without altering the clipboard. | public void | clearCommandLog() Remove all commands from the command log. | public boolean | clipboardNotEmpty() Return true if the clipboard contains contents which could be
transfered into the text. | public void | copy() Place the selected text on the clipboard. | public void | cut() Remove the selected text from the document and place it
on the clipboard. | public Object | getCharacterStyleOverSelection(Object key) This method inspects the character style runs in the selection
range (or the typing style at the insertion point). | public int | getCommandLogSize() Return the number of commands the command log can hold. | public static TextPanelSettings | getDefaultSettings() Return a TextPanelSettings instance with all settings set
to the default values. | public AttributeMap | getDefaultValues() Return an AttributeMap of keys with default values. | public int | getFormatWidth() Return the total format width, in pixels. | ATextPanelImpl | getImpl() | public KeyRemap | getKeyRemap() Return the KeyRemap used to process key events. | public Object | getParagraphStyleOverSelection(Object key) This method inspects the paragraph style runs in the selection
range (or the typing style at the insertion point). | public int | getSelectionEnd() Return the offset of the end of the selection. | public int | getSelectionStart() Return the offset of the start of the selection. | public MConstText | getText() Return the text document in the JTextPanel. | public int | getTextLength() Return the length of the text document in the JTextPanel. | public void | insert(MConstText newText, int position) Insert the given text into the document at the given position. | public boolean | isModified() Return the modification flag of the current text change. | public void | modifyCharacterStyleOnSelection(StyleModifier modifier) Modify the character styles on the selected characters. | public void | modifyParagraphStyleOnSelection(StyleModifier modifier) Modify the paragraph styles in paragraphs containing selected characters, or
the paragraph containing the insertion point. | public boolean | paragraphIsLeftToRight(int offset) Return true if the paragraph at the given offset is left-to-right. | public void | paste() Replace the currently selected text with the text on the clipboard. | public void | redo() Redo the most recent text change. | public void | removeListener(TextPanelListener listener) Remove the given TextPanelListener from the listeners which will
receive update notifications from this JTextPanel. | public void | replaceRange(MConstText newText, int start, int end) Replace the given range with newText. | public void | select(int selectionStart, int selectionEnd) Set the selection range to the given range. | public void | selectAll() Select all of the text in the document. | public void | setBackground(Color color) | public void | setCaretPosition(int position) Set the selection range to an insertion point at the given
offset. | public void | setCommandLogSize(int size) Set the number of commands the command log can hold. | public void | setKeyRemap(KeyRemap remap) Use the given KeyRemap to map key events to characters.
Only key
events are affected by the remap; other text entering the
control (via the clipboard, for example) is not affected
by the KeyRemap.
Do not pass null to this method to leave key
events unmapped. | public void | setModified(boolean modified) Set the modification flag of the current text change. | public void | setSelectionEnd(int selectionEnd) Set the end of the selection range. | public void | setSelectionStart(int selectionStart) Set the beginning of the selection range. | public void | setText(MConstText newText) Set the document to newText. | public void | undo() Undo the most recent text change. |
JTextPanel | public JTextPanel(MConstText initialText, java.awt.datatransfer.Clipboard clipboard)(Code) | | Create a new JTextPanel with the default settings.
Parameters: initialText - the text document. If null document text is empty. Parameters: clipboard - the clipboard to use for cut, copy, and pasteoperations. If null this panel will use a private clipboard. |
JTextPanel | public JTextPanel(TextPanelSettings settings, MConstText initialText, Clipboard clipboard)(Code) | | Create a new JTextPanel.
Parameters: settings - the settings for this JTextPanel Parameters: initialText - the text document. If null document text is empty. Parameters: clipboard - the clipboard to use for cut, copy, and pasteoperations. If null this panel will use a private clipboard. See Also: TextPanelSettings |
addListener | public void addListener(TextPanelListener listener)(Code) | | Add the given TextPanelListener to the listeners which will
receive update notifications from this JTextPanel.
Parameters: listener - the listener to add |
append | public void append(MConstText newText)(Code) | | Append the given text to the end of the document. Equivalent to
insert(newText, getTextLength()).
Parameters: newText - the text to append to the document |
canRedo | public boolean canRedo()(Code) | | Return true if there is a change which can be redone.
true if there is a change which can be redone. |
canUndo | public boolean canUndo()(Code) | | Return true if there is a change which can be undone.
true if there is a change which can be undone. |
clear | public void clear()(Code) | | Remove selected text from the document, without altering the clipboard.
This method has no effect if the
text is not editable.
|
clearCommandLog | public void clearCommandLog()(Code) | | Remove all commands from the command log.
|
clipboardNotEmpty | public boolean clipboardNotEmpty()(Code) | | Return true if the clipboard contains contents which could be
transfered into the text.
true if the clipboard has text content. |
copy | public void copy()(Code) | | Place the selected text on the clipboard. This method has
no effect if no text is selected.
|
cut | public void cut()(Code) | | Remove the selected text from the document and place it
on the clipboard. This method has no effect if the text
is not editable, or if no text is selected.
|
getCharacterStyleOverSelection | public Object getCharacterStyleOverSelection(Object key)(Code) | | This method inspects the character style runs in the selection
range (or the typing style at the insertion point). It returns:
- The value of key, if the value of key
is the same in all of the style runs in the selection, or
- MULTIPLE_VALUES, if two or more style runs have different
values for key.
If a style run does not contain key,
its value is considered to be the default style for key,
as defined by the default values AttributeMap. Note that if
key does not have a default value this method may return
null.
This method is useful for configuring style menus.
Parameters: key - the key used to retrieve values for comparison See Also: MTextPanel.MULTIPLE_VALUES |
getCommandLogSize | public int getCommandLogSize()(Code) | | Return the number of commands the command log can hold.
the number of commands the command log can hold |
getDefaultSettings | public static TextPanelSettings getDefaultSettings()(Code) | | Return a TextPanelSettings instance with all settings set
to the default values. Clients can modify this object;
modifications will not affect the default values.
a TextPanelSettings instance set to default values See Also: TextPanelSettings |
getDefaultValues | public AttributeMap getDefaultValues()(Code) | | Return an AttributeMap of keys with default values. The default
values are used when displaying text for values which are not
specified in the text.
an AttributeMap of default key-value pairs |
getFormatWidth | public int getFormatWidth()(Code) | | Return the total format width, in pixels. The format width is the
width to which text is wrapped.
the format width |
getParagraphStyleOverSelection | public Object getParagraphStyleOverSelection(Object key)(Code) | | This method inspects the paragraph style runs in the selection
range (or the typing style at the insertion point). It returns:
- The value of key, if the value of key
is the same in all of the style runs in the selection, or
- MULTIPLE_VALUES, if two or more style runs have
different values for key.
If a style run does not contain key,
its value is considered to be the default style for key,
as defined by the default values AttributeMap. Note that if
key does not have a default value this method may return
null.
This method is useful for configuring style menus.
Parameters: key - the key used to retrieve values for comparison See Also: MTextPanel.MULTIPLE_VALUES |
getSelectionEnd | public int getSelectionEnd()(Code) | | Return the offset of the end of the selection.
|
getSelectionStart | public int getSelectionStart()(Code) | | Return the offset of the start of the selection.
|
getText | public MConstText getText()(Code) | | Return the text document in the JTextPanel.
the text document in the JTextPanel. |
getTextLength | public int getTextLength()(Code) | | Return the length of the text document in the JTextPanel.
the length of the text document in the JTextPanel |
insert | public void insert(MConstText newText, int position)(Code) | | Insert the given text into the document at the given position.
Equivalent to
replaceRange(newText, position, position).
Parameters: newText - the text to insert into the document. Parameters: position - the position in the document where thetext will be inserted |
modifyCharacterStyleOnSelection | public void modifyCharacterStyleOnSelection(StyleModifier modifier)(Code) | | Modify the character styles on the selected characters. If no characters
are selected, modify the typing style.
Parameters: modifier - the StyleModifier with which to modify the styles |
modifyParagraphStyleOnSelection | public void modifyParagraphStyleOnSelection(StyleModifier modifier)(Code) | | Modify the paragraph styles in paragraphs containing selected characters, or
the paragraph containing the insertion point.
Parameters: modifier - the StyleModifier with which to modify the styles |
paragraphIsLeftToRight | public boolean paragraphIsLeftToRight(int offset)(Code) | | Return true if the paragraph at the given offset is left-to-right.
Parameters: offset - an offset in the text true if the paragraph at the given offset is left-to-right |
paste | public void paste()(Code) | | Replace the currently selected text with the text on the clipboard.
This method has no effect if the text is not editable, or if no
text is on the clipboard.
|
redo | public void redo()(Code) | | Redo the most recent text change. This method has no effect if
there is no change to redo.
|
removeListener | public void removeListener(TextPanelListener listener)(Code) | | Remove the given TextPanelListener from the listeners which will
receive update notifications from this JTextPanel.
Parameters: listener - the listener to remove |
replaceRange | public void replaceRange(MConstText newText, int start, int end)(Code) | | Replace the given range with newText. After this
operation the selection range is an insertion point at the
end of the new text.
Parameters: newText - the text with which to replace the range Parameters: start - the beginning of the range to replace Parameters: end - the end of the range to replace |
select | public void select(int selectionStart, int selectionEnd)(Code) | | Set the selection range to the given range. The range start
is pinned between 0 and the text length; the range end is pinned
between the range start and the end of the text. These semantics
are identical to those of java.awt.TextComponent.
This method has no effect if the text is not selectable.
Parameters: selectionStart - the beginning of the selection range Parameters: selectionEnd - the end of the selection range |
selectAll | public void selectAll()(Code) | | Select all of the text in the document. This method has no effect if
the text is not selectable.
|
setBackground | public void setBackground(Color color)(Code) | | |
setCaretPosition | public void setCaretPosition(int position)(Code) | | Set the selection range to an insertion point at the given
offset. This is equivalent to
select(position, position).
Parameters: position - the offset of the new insertion point |
setCommandLogSize | public void setCommandLogSize(int size)(Code) | | Set the number of commands the command log can hold. All
redoable commands are removed when this method is called.
Parameters: size - the number of commands kept in the command log |
setKeyRemap | public void setKeyRemap(KeyRemap remap)(Code) | | Use the given KeyRemap to map key events to characters.
Only key
events are affected by the remap; other text entering the
control (via the clipboard, for example) is not affected
by the KeyRemap.
Do not pass null to this method to leave key
events unmapped. Instead, use KeyRemap.getIdentityRemap()
Parameters: remap - the KeyRemap to use for mapping key events to characters exception: java.lang.NullPointerException - if parameter is null See Also: KeyRemap |
setModified | public void setModified(boolean modified)(Code) | | Set the modification flag of the current text change.
|
setSelectionEnd | public void setSelectionEnd(int selectionEnd)(Code) | | Set the end of the selection range. This is
equivalent to select(getSelectionStart(), selectionEnd).
Parameters: selectionEnd - the end of the new selection range |
setSelectionStart | public void setSelectionStart(int selectionStart)(Code) | | Set the beginning of the selection range. This is
equivalent to select(selectionStart, getSelectionEnd()).
Parameters: selectionStart - the start of the new selection range |
setText | public void setText(MConstText newText)(Code) | | Set the document to newText. This operation
modifies the text in the JTextPanel. It does not modify or adopt
newText. This method sets the selection an insertion point at
the end of the text.
Parameters: newText - the text which will replace the current text. |
undo | public void undo()(Code) | | Undo the most recent text change. This method has no effect if
there is no change to undo.
|
Methods inherited from javax.swing.JComponent | public void addAncestorListener(AncestorListener listener)(Code)(Java Doc) public void addNotify()(Code)(Java Doc) public synchronized void addVetoableChangeListener(VetoableChangeListener listener)(Code)(Java Doc) public void computeVisibleRect(Rectangle visibleRect)(Code)(Java Doc) public boolean contains(int x, int y)(Code)(Java Doc) public JToolTip createToolTip()(Code)(Java Doc) public void disable()(Code)(Java Doc) public void enable()(Code)(Java Doc) public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)(Code)(Java Doc) public void firePropertyChange(String propertyName, int oldValue, int newValue)(Code)(Java Doc) public void firePropertyChange(String propertyName, char oldValue, char newValue)(Code)(Java Doc) protected void fireVetoableChange(String propertyName, Object oldValue, Object newValue) throws java.beans.PropertyVetoException(Code)(Java Doc) public AccessibleContext getAccessibleContext()(Code)(Java Doc) public ActionListener getActionForKeyStroke(KeyStroke aKeyStroke)(Code)(Java Doc) final public ActionMap getActionMap()(Code)(Java Doc) public float getAlignmentX()(Code)(Java Doc) public float getAlignmentY()(Code)(Java Doc) public AncestorListener[] getAncestorListeners()(Code)(Java Doc) public boolean getAutoscrolls()(Code)(Java Doc) public int getBaseline(int width, int height)(Code)(Java Doc) public BaselineResizeBehavior getBaselineResizeBehavior()(Code)(Java Doc) public Border getBorder()(Code)(Java Doc) public Rectangle getBounds(Rectangle rv)(Code)(Java Doc) final public Object getClientProperty(Object key)(Code)(Java Doc) protected Graphics getComponentGraphics(Graphics g)(Code)(Java Doc) public JPopupMenu getComponentPopupMenu()(Code)(Java Doc) public int getConditionForKeyStroke(KeyStroke aKeyStroke)(Code)(Java Doc) public int getDebugGraphicsOptions()(Code)(Java Doc) public static Locale getDefaultLocale()(Code)(Java Doc) public FontMetrics getFontMetrics(Font font)(Code)(Java Doc) public Graphics getGraphics()(Code)(Java Doc) public int getHeight()(Code)(Java Doc) public boolean getInheritsPopupMenu()(Code)(Java Doc) final public InputMap getInputMap(int condition)(Code)(Java Doc) final public InputMap getInputMap()(Code)(Java Doc) public InputVerifier getInputVerifier()(Code)(Java Doc) public Insets getInsets()(Code)(Java Doc) public Insets getInsets(Insets insets)(Code)(Java Doc) public T[] getListeners(Class<T> listenerType)(Code)(Java Doc) public Point getLocation(Point rv)(Code)(Java Doc) public Dimension getMaximumSize()(Code)(Java Doc) public Dimension getMinimumSize()(Code)(Java Doc) public Component getNextFocusableComponent()(Code)(Java Doc) public Point getPopupLocation(MouseEvent event)(Code)(Java Doc) public Dimension getPreferredSize()(Code)(Java Doc) public KeyStroke[] getRegisteredKeyStrokes()(Code)(Java Doc) public JRootPane getRootPane()(Code)(Java Doc) public Dimension getSize(Dimension rv)(Code)(Java Doc) public Point getToolTipLocation(MouseEvent event)(Code)(Java Doc) public String getToolTipText()(Code)(Java Doc) public String getToolTipText(MouseEvent event)(Code)(Java Doc) public Container getTopLevelAncestor()(Code)(Java Doc) public TransferHandler getTransferHandler()(Code)(Java Doc) public String getUIClassID()(Code)(Java Doc) public boolean getVerifyInputWhenFocusTarget()(Code)(Java Doc) public synchronized VetoableChangeListener[] getVetoableChangeListeners()(Code)(Java Doc) public Rectangle getVisibleRect()(Code)(Java Doc) public int getWidth()(Code)(Java Doc) public int getX()(Code)(Java Doc) public int getY()(Code)(Java Doc) public void grabFocus()(Code)(Java Doc) public boolean isDoubleBuffered()(Code)(Java Doc) public static boolean isLightweightComponent(Component c)(Code)(Java Doc) public boolean isManagingFocus()(Code)(Java Doc) public boolean isOpaque()(Code)(Java Doc) public boolean isOptimizedDrawingEnabled()(Code)(Java Doc) final public boolean isPaintingForPrint()(Code)(Java Doc) public boolean isPaintingTile()(Code)(Java Doc) public boolean isRequestFocusEnabled()(Code)(Java Doc) public boolean isValidateRoot()(Code)(Java Doc) public void paint(Graphics g)(Code)(Java Doc) protected void paintBorder(Graphics g)(Code)(Java Doc) protected void paintChildren(Graphics g)(Code)(Java Doc) protected void paintComponent(Graphics g)(Code)(Java Doc) public void paintImmediately(int x, int y, int w, int h)(Code)(Java Doc) public void paintImmediately(Rectangle r)(Code)(Java Doc) protected String paramString()(Code)(Java Doc) public void print(Graphics g)(Code)(Java Doc) public void printAll(Graphics g)(Code)(Java Doc) protected void printBorder(Graphics g)(Code)(Java Doc) protected void printChildren(Graphics g)(Code)(Java Doc) protected void printComponent(Graphics g)(Code)(Java Doc) protected void processComponentKeyEvent(KeyEvent e)(Code)(Java Doc) protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)(Code)(Java Doc) protected void processKeyEvent(KeyEvent e)(Code)(Java Doc) protected void processMouseEvent(MouseEvent e)(Code)(Java Doc) protected void processMouseMotionEvent(MouseEvent e)(Code)(Java Doc) final public void putClientProperty(Object key, Object value)(Code)(Java Doc) public void registerKeyboardAction(ActionListener anAction, String aCommand, KeyStroke aKeyStroke, int aCondition)(Code)(Java Doc) public void registerKeyboardAction(ActionListener anAction, KeyStroke aKeyStroke, int aCondition)(Code)(Java Doc) public void removeAncestorListener(AncestorListener listener)(Code)(Java Doc) public void removeNotify()(Code)(Java Doc) public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)(Code)(Java Doc) public void repaint(long tm, int x, int y, int width, int height)(Code)(Java Doc) public void repaint(Rectangle r)(Code)(Java Doc) public boolean requestDefaultFocus()(Code)(Java Doc) public void requestFocus()(Code)(Java Doc) public boolean requestFocus(boolean temporary)(Code)(Java Doc) public boolean requestFocusInWindow()(Code)(Java Doc) protected boolean requestFocusInWindow(boolean temporary)(Code)(Java Doc) public void resetKeyboardActions()(Code)(Java Doc) public void reshape(int x, int y, int w, int h)(Code)(Java Doc) public void revalidate()(Code)(Java Doc) public void scrollRectToVisible(Rectangle aRect)(Code)(Java Doc) final public void setActionMap(ActionMap am)(Code)(Java Doc) public void setAlignmentX(float alignmentX)(Code)(Java Doc) public void setAlignmentY(float alignmentY)(Code)(Java Doc) public void setAutoscrolls(boolean autoscrolls)(Code)(Java Doc) public void setBackground(Color bg)(Code)(Java Doc) public void setBorder(Border border)(Code)(Java Doc) public void setComponentPopupMenu(JPopupMenu popup)(Code)(Java Doc) public void setDebugGraphicsOptions(int debugOptions)(Code)(Java Doc) public static void setDefaultLocale(Locale l)(Code)(Java Doc) public void setDoubleBuffered(boolean aFlag)(Code)(Java Doc) public void setEnabled(boolean enabled)(Code)(Java Doc) public void setFocusTraversalKeys(int id, Set<? extends AWTKeyStroke> keystrokes)(Code)(Java Doc) public void setFont(Font font)(Code)(Java Doc) public void setForeground(Color fg)(Code)(Java Doc) public void setInheritsPopupMenu(boolean value)(Code)(Java Doc) final public void setInputMap(int condition, InputMap map)(Code)(Java Doc) public void setInputVerifier(InputVerifier inputVerifier)(Code)(Java Doc) public void setMaximumSize(Dimension maximumSize)(Code)(Java Doc) public void setMinimumSize(Dimension minimumSize)(Code)(Java Doc) public void setNextFocusableComponent(Component aComponent)(Code)(Java Doc) public void setOpaque(boolean isOpaque)(Code)(Java Doc) public void setPreferredSize(Dimension preferredSize)(Code)(Java Doc) public void setRequestFocusEnabled(boolean requestFocusEnabled)(Code)(Java Doc) public void setToolTipText(String text)(Code)(Java Doc) public void setTransferHandler(TransferHandler newHandler)(Code)(Java Doc) protected void setUI(ComponentUI newUI)(Code)(Java Doc) public void setVerifyInputWhenFocusTarget(boolean verifyInputWhenFocusTarget)(Code)(Java Doc) public void setVisible(boolean aFlag)(Code)(Java Doc) public void unregisterKeyboardAction(KeyStroke aKeyStroke)(Code)(Java Doc) public void update(Graphics g)(Code)(Java Doc) public void updateUI()(Code)(Java Doc)
|
|
|