All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.text.JTextUI

java.lang.Object
   |
   +----com.sun.java.swing.text.JTextUI

public abstract class JTextUI
extends Object
implements TextUI

Basis of a text components look-and-feel. This provides the basic editor view and controller services that may be useful when creating a look-and-feel for an extension of JTextComponent.

To use this class, subclasses must at a minimum subclass JViewFactory and implement the create method, and return it from the createViewFactory method. This determines how the model will be represented.


Variable Index

 o editor

Constructor Index

 o JTextUI(Color, Color)
The children of the view are all positioned overlayed one upon another.

Method Index

 o createCaret(Color, Color)
Create the object to use for a caret.
 o createController(JTextComponent)
This is defined to create the controller responsible binding events to actions in the text component.
 o createHighlighter()
Create the object to use for adding highlights.
 o createView()
This is defined to create the component responsible for the view.
 o createViewFactory()
Creates the factory to be used for building the various view fragments that make up the view that represents the model.
 o createViewport()
This creates a scrollable component that is the default view passed out by createView.
 o damageRange(Range)
 o deinstallUI(JComponent)
 o getActions()
 o getHighlights()
 o getHorizontalVisibility()
 o getInsertPosition()
 o getInsets(JComponent)
 o getKeymap()
TextUI#getKeymap
 o getMaximumSize(JComponent)
 o getMinimumSize(JComponent)
 o getPreferredSize(JComponent)
 o getVerticalVisibility()
 o installUI(JComponent)
 o modelToView(Position)
 o paint(Graphics, JComponent)
This view uses child components to represent the view so these methods are not needed.
 o setHorizontalVisibility(BoundedRangeModel)
 o setKeymap(Keymap)
TextUI#setKeymap
 o setVerticalVisibility(BoundedRangeModel)
 o viewToModel(Point)

Variables

 o editor
 protected JTextComponent editor

Constructors

 o JTextUI
 public JTextUI(Color select,
                Color caret)
The children of the view are all positioned overlayed one upon another. For this to be useful, only lightweight components are used in the construction of the view. If other planes are desired for a particular view, they can simply be added as additional children of the update batcher.

Parameters:
f - The factory used to populate the interior of the editor with components that have a mapping to an associated text model.
select - The highlight color to use for selections.
caret - The color to use for rendering the insert position.

Methods

 o createView
 protected Component createView()
This is defined to create the component responsible for the view. It is expected that this will be reimplemented to be more useful, but super.createView() should be called and the component returned should be decorated by the actual container that is enhancing the look. The result of this call is what gets installed into the associated JTextComponent as the implementation of the look-and-feel.

 o createViewport
 protected JTextUI. JTextView createViewport()
This creates a scrollable component that is the default view passed out by createView.

 o createViewFactory
 protected abstract JTextUI. JViewFactory createViewFactory()
Creates the factory to be used for building the various view fragments that make up the view that represents the model. This is what determines how the model will be represented.

See Also:
create
 o createController
 protected TextController createController(JTextComponent c)
This is defined to create the controller responsible binding events to actions in the text component. By default this is an instance of JTextController.

 o createCaret
 protected InsertPosition createCaret(Color caret,
                                      Color select)
Create the object to use for a caret. By default an instance of JInsertPosition is created. This method can be redefined to provide something else that implements the InputPosition interface or a subclass of JInsertPosition.

Parameters:
select - The highlight color to use for selections.
caret - The color to use for rendering the insert position.
 o createHighlighter
 protected Highlighter createHighlighter()
Create the object to use for adding highlights. By default an instance of JHighlighter is created. This method can be redefined to provide something else that implements the Highlighter interface or a subclass of JHighlighter.

 o installUI
 public void installUI(JComponent c)
See Also:
installUI
 o deinstallUI
 public void deinstallUI(JComponent c)
See Also:
deinstallUI
 o paint
 public void paint(Graphics g,
                   JComponent c)
This view uses child components to represent the view so these methods are not needed.

 o getPreferredSize
 public Dimension getPreferredSize(JComponent c)
 o getMinimumSize
 public Dimension getMinimumSize(JComponent c)
 o getMaximumSize
 public Dimension getMaximumSize(JComponent c)
 o getInsets
 public Insets getInsets(JComponent c)
 o modelToView
 public Rectangle modelToView(Position pos) throws BadLocation
Throws: BadLocation
If the given position does not represent a valid location in the associated document.
See Also:
modelToView
 o viewToModel
 public Position viewToModel(Point pt)
See Also:
viewToModel
 o damageRange
 public void damageRange(Range rng)
See Also:
damageRange
 o getInsertPosition
 public InsertPosition getInsertPosition()
See Also:
getInsertPosition
 o getHighlights
 public Highlighter getHighlights()
See Also:
getHighlights
 o setHorizontalVisibility
 public void setHorizontalVisibility(BoundedRangeModel vis)
See Also:
setHorizontalVisibility
 o getHorizontalVisibility
 public BoundedRangeModel getHorizontalVisibility()
See Also:
getHorizontalVisibility
 o setVerticalVisibility
 public void setVerticalVisibility(BoundedRangeModel vis)
See Also:
setVerticalVisibility
 o getVerticalVisibility
 public BoundedRangeModel getVerticalVisibility()
See Also:
getVerticalVisibility
 o getActions
 public Action[] getActions()
See Also:
getActions
 o setKeymap
 public void setKeymap(Keymap map)
TextUI#setKeymap

 o getKeymap
 public Keymap getKeymap()
TextUI#getKeymap


All Packages  Class Hierarchy  This Package  Previous  Next  Index