| Methods from java.awt.Component: |
|---|
|
action, add, addAWTComponentListener, addAWTFocusListener, addAWTInputMethodListener, addAWTKeyListener, addAWTMouseListener, addAWTMouseMotionListener, addAWTMouseWheelListener, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNewEvent, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, autoName, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createAccessibleContext, createBehavior, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, finishChildrenHierarchyChange, finishHierarchyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getCursorAncestor, getDefaultBackground, getDefaultForeground, getDefaultMinimumSize, getDefaultPreferredSize, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHWAncestor, getHWSurface, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getIndentStr, getInputContext, getInputMethodListeners, getInputMethodRequests, getInsets, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getNativeInsets, getNativeWindow, getObscuredRegion, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRealCursor, getRealParent, getRedrawManager, getRelativeEvent, getSize, getSize, getTextFieldKit, getTextKit, getToolkit, getTreeLock, getWidth, getWindowAncestor, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, initGraphics, inside, invalidate, isBackgroundSet, isCoalescer, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isEventEnabled, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFocusabilityExplicitlySet, isFocusable, isFontSet, isForegroundSet, isIndirectlyEnabled, isKeyEnabled, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isMouseEventEnabled, isMouseExitedExpected, isOpaque, isPeerFocusable, isPreferredSizeSet, isPrepainter, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, mapToDisplay, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, moveFocus, moveFocusOnHide, nativeWindowCreated, nextFocus, notifyInputMethod, onDrawImage, paint, paintAll, paramString, postEvent, postEvent, postHierarchyBoundsEvents, postprocessEvent, preferredSize, prepaint, prepare4HierarchyChange, prepareChildren4HierarchyChange, prepareImage, prepareImage, preprocessFocusEvent, preprocessKeyEvent, preprocessMouseEvent, preprocessMouseMotionEvent, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, propagateFont, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNextEvent, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeRelativeEvent, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusImpl, requestFocusInWindow, requestFocusInWindow, resetDefaultSize, reshape, resize, resize, setBackground, setBounds, setBounds, setBounds, setCaretPos, setCaretPosImpl, setComponentOrientation, setCursor, setCursor, setDropTarget, setEnabled, setEnabledImpl, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFocusable, setFont, setFontImpl, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMouseExitedExpected, setName, setParent, setPreferredSize, setRedrawManager, setSize, setSize, setTextFieldKit, setTextKit, setVisible, show, show, size, spreadHierarchyBoundsEvents, toString, transferFocus, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate, validateImpl |
| Method from javax.swing.JTextPane Detail: |
public Style addStyle(String styleName,
Style parent) {
return getStyledDocument().addStyle(styleName, parent);
}
|
protected EditorKit createDefaultEditorKit() {
return new StyledEditorKit();
}
|
public AttributeSet getCharacterAttributes() {
final int position = getCaretPosition();
if (position < 0) {
return null;
}
return this.getStyledDocument().getCharacterElement(position)
.getAttributes();
}
|
public MutableAttributeSet getInputAttributes() {
return getStyledEditorKit().getInputAttributes();
}
|
public Style getLogicalStyle() {
final int position = getCaretPosition();
if (position < 0) {
return null;
}
return getStyledDocument().getLogicalStyle(position);
}
|
public AttributeSet getParagraphAttributes() {
final int position = getCaretPosition();
if (position < 0) {
return null;
}
return getStyledDocument().getParagraphElement(position)
.getAttributes();
}
|
public Style getStyle(String styleName) {
return getStyledDocument().getStyle(styleName);
}
|
public StyledDocument getStyledDocument() {
return (StyledDocument)getDocument();
}
|
protected final StyledEditorKit getStyledEditorKit() {
return (StyledEditorKit) getEditorKit();
}
|
public String getUIClassID() {
return uiClassID;
}
|
public synchronized void insertComponent(Component c) {
final MutableAttributeSet attrs = new SimpleAttributeSet();
StyleConstants.setComponent(attrs, c);
replaceObject(getStyledDocument(),
getSelectionStart(),
getSelectionEnd(),
attrs);
}
To insert component we should insert in the document whitespace with
special attribute StyleConstants.ComponentAttribute |
public synchronized void insertIcon(Icon g) {
final MutableAttributeSet attrs = new SimpleAttributeSet();
StyleConstants.setIcon(attrs, g);
replaceObject(getStyledDocument(),
getSelectionStart(),
getSelectionEnd(),
attrs);
}
To insert icon we should insert in the document whitespace with
special attribute StyleConstants.IconAttribute |
public void removeStyle(String styleName) {
getStyledDocument().removeStyle(styleName);
}
|
public void replaceSelection(String content) {
if (!isEditable()) {
new DefaultEditorKit.BeepAction().actionPerformed(null);
return;
}
final int start = getSelectionStart();
final int end = getSelectionEnd();
final StyledDocument doc = getStyledDocument();
AttributeSet attrs;
try {
if (start != end) {
attrs = doc.getCharacterElement(start).getAttributes();
doc.remove(start, end - start);
if (StyleConstants.getIcon(attrs) != null) {
final MutableAttributeSet newAttrs =
new SimpleAttributeSet(attrs);
newAttrs.removeAttribute(StyleConstants.IconAttribute);
newAttrs.removeAttribute(AbstractDocument
.ElementNameAttribute);
attrs = newAttrs;
}
if (StyleConstants.getComponent(attrs) != null) {
final MutableAttributeSet newAttrs =
new SimpleAttributeSet(attrs);
newAttrs.removeAttribute(StyleConstants.ComponentAttribute);
newAttrs.removeAttribute(AbstractDocument
.ElementNameAttribute);
attrs = newAttrs;
}
} else {
attrs = getInputAttributes();
}
if (content != null) {
doc.insertString(start, content, attrs);
}
} catch (BadLocationException e) {
}
}
This method differs from JEditorPane.replaceSelection only in one case.
If there is selection the replacement text should have not the attributes
currently defined for input, but the attributes of the first selected
symbol. |
public synchronized void setCharacterAttributes(AttributeSet attr,
boolean replace) {
TextUtils.setCharacterAttributes(attr, replace, this,
getStyledDocument(),
getInputAttributes());
}
|
public void setDocument(Document doc) {
if (doc instanceof StyledDocument) {
super.setDocument(doc);
} else {
throw new IllegalArgumentException(Messages.getString("swing.48", "StyledDocument")); //$NON-NLS-1$ //$NON-NLS-2$
}
}
|
public final void setEditorKit(EditorKit kit) {
if (kit instanceof StyledEditorKit) {
super.setEditorKit(kit);
} else {
throw new IllegalArgumentException(Messages.getString("swing.49","StyledEditorKit")); //$NON-NLS-1$ //$NON-NLS-2$
}
}
|
public void setLogicalStyle(Style s) {
getStyledDocument().setLogicalStyle(getCaretPosition(), s);
}
|
public synchronized void setParagraphAttributes(AttributeSet attr,
boolean replace) {
TextUtils.setParagraphAttributes(attr, replace, this,
getStyledDocument());
}
|
public void setStyledDocument(StyledDocument doc) {
super.setDocument(doc);
}
|