javax.swing.plaf.multi
Class MultiTextUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.TextUI
          extended by javax.swing.plaf.multi.MultiTextUI

public class MultiTextUI
extends TextUI

A UI delegate that that coordinates multiple TextUI instances, one from the primary look and feel, and one or more from the auxiliary look and feel(s).

See Also:
UIManager.addAuxiliaryLookAndFeel(LookAndFeel)

Field Summary
protected  Vector uis
          A list of references to the actual component UIs.
 
Constructor Summary
MultiTextUI()
          Creates a new MultiTextUI instance.
 
Method Summary
 boolean contains(JComponent c, int x, int y)
          Calls the ComponentUI.contains(JComponent, int, int) method for all the UI delegates managed by this MultiTextUI, returning the result for the UI delegate from the primary look and feel.
static ComponentUI createUI(JComponent target)
          Creates a delegate object for the specified component.
 void damageRange(JTextComponent tc, int start, int end)
          Calls the TextUI.damageRange(JTextComponent, int, int) method for all the UI delegates managed by this MultiTextUI.
 void damageRange(JTextComponent tc, int start, int end, Position.Bias startBias, Position.Bias endBias)
          Calls the TextUI.damageRange(JTextComponent, int, int, Position.Bias, Position.Bias) method for all the UI delegates managed by this MultiTextUI.
 Accessible getAccessibleChild(JComponent c, int i)
          Calls the ComponentUI.getAccessibleChild(JComponent, int) method for all the UI delegates managed by this MultiTextUI, returning the child for the UI delegate from the primary look and feel.
 int getAccessibleChildrenCount(JComponent c)
          Calls the ComponentUI.getAccessibleChildrenCount(JComponent) method for all the UI delegates managed by this MultiTextUI, returning the count for the UI delegate from the primary look and feel.
 EditorKit getEditorKit(JTextComponent tc)
          Calls the TextUI.getEditorKit(JTextComponent) method for all the UI delegates managed by this MultiTextUI, returning the editor kit for the UI delegate from the primary look and feel.
 Dimension getMaximumSize(JComponent c)
          Calls the ComponentUI.getMaximumSize(JComponent) method for all the UI delegates managed by this MultiTextUI, returning the maximum size for the UI delegate from the primary look and feel.
 Dimension getMinimumSize(JComponent c)
          Calls the ComponentUI.getMinimumSize(JComponent) method for all the UI delegates managed by this MultiTextUI, returning the minimum size for the UI delegate from the primary look and feel.
 int getNextVisualPositionFrom(JTextComponent tc, int pos, Position.Bias bias, int direction, Position.Bias[] outBias)
          Calls the TextUI.getNextVisualPositionFrom(JTextComponent, int, Position.Bias, int, Position.Bias[]) method for all the UI delegates managed by this MultiTextUI, returning the position for the UI delegate from the primary look and feel.
 Dimension getPreferredSize(JComponent c)
          Calls the ComponentUI.getPreferredSize(JComponent) method for all the UI delegates managed by this MultiTextUI, returning the preferred size for the UI delegate from the primary look and feel.
 View getRootView(JTextComponent tc)
          Calls the TextUI.getRootView(JTextComponent) method for all the UI delegates managed by this MultiTextUI, returning the view for the UI delegate from the primary look and feel.
 ComponentUI[] getUIs()
          Returns an array containing the UI delegates managed by this MultiTextUI.
 void installUI(JComponent c)
          Calls the ComponentUI.installUI(JComponent) method for all the UI delegates managed by this MultiTextUI.
 Rectangle modelToView(JTextComponent tc, int pos)
          Calls the TextUI.modelToView(JTextComponent, int) method for all the UI delegates managed by this MultiTextUI, returning the bounds for the UI delegate from the primary look and feel.
 Rectangle modelToView(JTextComponent tc, int pos, Position.Bias bias)
          Calls the TextUI.modelToView(JTextComponent, int, Position.Bias) method for all the UI delegates managed by this MultiTextUI, returning the bounds for the UI delegate from the primary look and feel.
 void paint(Graphics g, JComponent c)
          Calls the paint(Graphics, JComponent) method for all the UI delegates managed by this MultiTextUI.
 void uninstallUI(JComponent c)
          Calls the ComponentUI.uninstallUI(JComponent) method for all the UI delegates managed by this MultiTextUI.
 void update(Graphics g, JComponent c)
          Calls the ComponentUI.update(Graphics, JComponent) method for all the UI delegates managed by this MultiTextUI.
 int viewToModel(JTextComponent t, Point pt)
          Calls the TextUI.viewToModel(JTextComponent, Point) method for all the UI delegates managed by this MultiTextUI, returning the position for the UI delegate from the primary look and feel.
 int viewToModel(JTextComponent tc, Point loc, Position.Bias[] outBias)
          Calls the TextUI#viewToModel(JTextComponent, Point, Bias[]) method for all the UI delegates managed by this MultiTextUI, returning the position for the UI delegate from the primary look and feel.
 
Methods inherited from class javax.swing.plaf.TextUI
getToolTipText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

uis

protected Vector uis
A list of references to the actual component UIs.

Constructor Detail

MultiTextUI

public MultiTextUI()
Creates a new MultiTextUI instance.

See Also:
createUI(JComponent)
Method Detail

createUI

public static ComponentUI createUI(JComponent target)
Creates a delegate object for the specified component. If any auxiliary look and feels support this component, a MultiTextUI is returned, otherwise the UI from the default look and feel is returned.

Parameters:
target - the component.
See Also:
MultiLookAndFeel.createUIs(ComponentUI, Vector, JComponent)

installUI

public void installUI(JComponent c)
Calls the ComponentUI.installUI(JComponent) method for all the UI delegates managed by this MultiTextUI.

Overrides:
installUI in class ComponentUI
Parameters:
c - the component.
See Also:
ComponentUI.uninstallUI(javax.swing.JComponent), JComponent.setUI(javax.swing.plaf.ComponentUI), JComponent.updateUI()

uninstallUI

public void uninstallUI(JComponent c)
Calls the ComponentUI.uninstallUI(JComponent) method for all the UI delegates managed by this MultiTextUI.

Overrides:
uninstallUI in class ComponentUI
Parameters:
c - the component.
See Also:
ComponentUI.installUI(javax.swing.JComponent), JComponent.setUI(javax.swing.plaf.ComponentUI), JComponent.updateUI()

getUIs

public ComponentUI[] getUIs()
Returns an array containing the UI delegates managed by this MultiTextUI. The first item in the array is always the UI delegate from the installed default look and feel.

Returns:
An array of UI delegates.

contains

public boolean contains(JComponent c,
                        int x,
                        int y)
Calls the ComponentUI.contains(JComponent, int, int) method for all the UI delegates managed by this MultiTextUI, returning the result for the UI delegate from the primary look and feel.

Overrides:
contains in class ComponentUI
Parameters:
c - the component.
x - the x-coordinate.
y - the y-coordinate.
Returns:
true if the specified (x, y) coordinate falls within the bounds of the component as rendered by the UI delegate in the primary look and feel, and false otherwise.

update

public void update(Graphics g,
                   JComponent c)
Calls the ComponentUI.update(Graphics, JComponent) method for all the UI delegates managed by this MultiTextUI.

Overrides:
update in class ComponentUI
Parameters:
g - the graphics device.
c - the component.
See Also:
ComponentUI.paint(java.awt.Graphics, javax.swing.JComponent), JComponent.paintComponent(java.awt.Graphics)

paint

public void paint(Graphics g,
                  JComponent c)
Calls the paint(Graphics, JComponent) method for all the UI delegates managed by this MultiTextUI.

Overrides:
paint in class ComponentUI
Parameters:
g - the graphics device.
c - the component.

getPreferredSize

public Dimension getPreferredSize(JComponent c)
Calls the ComponentUI.getPreferredSize(JComponent) method for all the UI delegates managed by this MultiTextUI, returning the preferred size for the UI delegate from the primary look and feel.

Overrides:
getPreferredSize in class ComponentUI
Parameters:
c - the component.
Returns:
The preferred size returned by the UI delegate from the primary look and feel.

getMinimumSize

public Dimension getMinimumSize(JComponent c)
Calls the ComponentUI.getMinimumSize(JComponent) method for all the UI delegates managed by this MultiTextUI, returning the minimum size for the UI delegate from the primary look and feel.

Overrides:
getMinimumSize in class ComponentUI
Parameters:
c - the component.
Returns:
The minimum size returned by the UI delegate from the primary look and feel.

getMaximumSize

public Dimension getMaximumSize(JComponent c)
Calls the ComponentUI.getMaximumSize(JComponent) method for all the UI delegates managed by this MultiTextUI, returning the maximum size for the UI delegate from the primary look and feel.

Overrides:
getMaximumSize in class ComponentUI
Parameters:
c - the component.
Returns:
The maximum size returned by the UI delegate from the primary look and feel.

getAccessibleChildrenCount

public int getAccessibleChildrenCount(JComponent c)
Calls the ComponentUI.getAccessibleChildrenCount(JComponent) method for all the UI delegates managed by this MultiTextUI, returning the count for the UI delegate from the primary look and feel.

Overrides:
getAccessibleChildrenCount in class ComponentUI
Parameters:
c - the component.
Returns:
The count returned by the UI delegate from the primary look and feel.

getAccessibleChild

public Accessible getAccessibleChild(JComponent c,
                                     int i)
Calls the ComponentUI.getAccessibleChild(JComponent, int) method for all the UI delegates managed by this MultiTextUI, returning the child for the UI delegate from the primary look and feel.

Overrides:
getAccessibleChild in class ComponentUI
Parameters:
c - the component
i - the child index.
Returns:
The child returned by the UI delegate from the primary look and feel.

modelToView

public Rectangle modelToView(JTextComponent tc,
                             int pos)
                      throws BadLocationException
Calls the TextUI.modelToView(JTextComponent, int) method for all the UI delegates managed by this MultiTextUI, returning the bounds for the UI delegate from the primary look and feel.

Specified by:
modelToView in class TextUI
Parameters:
tc - the text component.
pos - the zero-based index of the character into the document model.
Returns:
The bounds returned by the UI delegate from the primary look and feel.
Throws:
BadLocationException - if pos does not designate a valid position in the document model.
See Also:
ComponentView.modelToView(int, Shape, Position.Bias)

modelToView

public Rectangle modelToView(JTextComponent tc,
                             int pos,
                             Position.Bias bias)
                      throws BadLocationException
Calls the TextUI.modelToView(JTextComponent, int, Position.Bias) method for all the UI delegates managed by this MultiTextUI, returning the bounds for the UI delegate from the primary look and feel.

Specified by:
modelToView in class TextUI
Parameters:
tc - the text component.
pos - the zero-based index of the character into the document model.
bias - whether to take the character before or after the caret position indicated by pos. The value must be either Position.Bias.Backward or Position.Bias.Forward.
Returns:
The bounds returned by the UI delegate from the primary look and feel.
Throws:
BadLocationException - if pos does not designate a valid position in the document model.
See Also:
ComponentView.modelToView(int, Shape, Position.Bias)

viewToModel

public int viewToModel(JTextComponent t,
                       Point pt)
Calls the TextUI.viewToModel(JTextComponent, Point) method for all the UI delegates managed by this MultiTextUI, returning the position for the UI delegate from the primary look and feel.

Specified by:
viewToModel in class TextUI
Parameters:
t - the text component.
pt - the point.
Returns:
The position returned by the UI delegate from the primary look and feel.
See Also:
TextUI.viewToModel(JTextComponent, Point, Position.Bias[])

viewToModel

public int viewToModel(JTextComponent tc,
                       Point loc,
                       Position.Bias[] outBias)
Calls the TextUI#viewToModel(JTextComponent, Point, Bias[]) method for all the UI delegates managed by this MultiTextUI, returning the position for the UI delegate from the primary look and feel.

Specified by:
viewToModel in class TextUI
Parameters:
tc - the text component.
loc - the position in view coordinates.
outBias - an array whose size must be at least one. After the call, outBias[0] will indicate whether loc is in the glyph before (Position.Bias.Backward) or after (Position.Bias.Forward) the returned caret position.
Returns:
The position returned by the UI delegate from the primary look and feel.

getNextVisualPositionFrom

public int getNextVisualPositionFrom(JTextComponent tc,
                                     int pos,
                                     Position.Bias bias,
                                     int direction,
                                     Position.Bias[] outBias)
                              throws BadLocationException
Calls the TextUI.getNextVisualPositionFrom(JTextComponent, int, Position.Bias, int, Position.Bias[]) method for all the UI delegates managed by this MultiTextUI, returning the position for the UI delegate from the primary look and feel.

Specified by:
getNextVisualPositionFrom in class TextUI
Parameters:
tc - the text component.
pos - the current caret position, a zero-based index into the document model.
bias - whether to take the character before or after the caret position indicated by pos. The value must be either Position.Bias.Backward or Position.Bias.Forward.
direction - the visual direction. Pass SwingConstants.WEST for the left arrow key, SwingConstants.EAST for the right arrow key, SwingConstants.NORTH for the up arrow key, or SwingConstants.SOUTH for the down arrow key.
Returns:
The position returned by the UI delegate from the primary look and feel.
Throws:
BadLocationException - if pos does not designate a valid position in the document model.

damageRange

public void damageRange(JTextComponent tc,
                        int start,
                        int end)
Calls the TextUI.damageRange(JTextComponent, int, int) method for all the UI delegates managed by this MultiTextUI.

Specified by:
damageRange in class TextUI
Parameters:
tc - the component.
start - the start position.
end - the end position.

damageRange

public void damageRange(JTextComponent tc,
                        int start,
                        int end,
                        Position.Bias startBias,
                        Position.Bias endBias)
Calls the TextUI.damageRange(JTextComponent, int, int, Position.Bias, Position.Bias) method for all the UI delegates managed by this MultiTextUI.

Specified by:
damageRange in class TextUI
Parameters:
tc - the component.
start - the start position.
end - the end position.
startBias - the start bias.
endBias - the end bias.

getEditorKit

public EditorKit getEditorKit(JTextComponent tc)
Calls the TextUI.getEditorKit(JTextComponent) method for all the UI delegates managed by this MultiTextUI, returning the editor kit for the UI delegate from the primary look and feel.

Specified by:
getEditorKit in class TextUI
Parameters:
tc - the text component.
Returns:
The editor kit returned by the UI delegate from the primary look and feel.

getRootView

public View getRootView(JTextComponent tc)
Calls the TextUI.getRootView(JTextComponent) method for all the UI delegates managed by this MultiTextUI, returning the view for the UI delegate from the primary look and feel.

Specified by:
getRootView in class TextUI
Parameters:
tc - the text component.
Returns:
The view returned by the UI delegate from the primary look and feel.