javax.swing.text
Class ComponentView

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.swing.text.View sample code for javax.swing.text.View definition code for javax.swing.text.View 
      extended by javax.swing.text.ComponentView
All Implemented Interfaces:
SwingConstants sample code for javax.swing.SwingConstants definition code for javax.swing.SwingConstants
Direct Known Subclasses:
FormView sample code for javax.swing.text.html.FormView definition code for javax.swing.text.html.FormView , ObjectView sample code for javax.swing.text.html.ObjectView definition code for javax.swing.text.html.ObjectView

public class ComponentView
extends View sample code for javax.swing.text.View definition code for javax.swing.text.View

Component decorator that implements the view interface. The entire element is used to represent the component. This acts as a gateway from the display-only View implementations to interactive lightweight components (ie it allows components to be embedded into the View hierarchy).

The component is placed relative to the text baseline according to the value returned by Component.getAlignmentY. For Swing components this value can be conveniently set using the method JComponent.setAlignmentY. For example, setting a value of 0.75 will cause 75 percent of the component to be above the baseline, and 25 percent of the component to be below the baseline.

This class is implemented to do the extra work necessary to work properly in the presence of multiple threads (i.e. from asynchronous notification of model changes for example) by ensuring that all component access is done on the event thread.

The component used is determined by the return value of the createComponent method. The default implementation of this method is to return the component held as an attribute of the element (by calling StyleConstants.getComponent). A limitation of this behavior is that the component cannot be used by more than one text component (i.e. with a shared model). Subclasses can remove this constraint by implementing the createComponent to actually create a component based upon some kind of specification contained in the attributes. The ObjectView class in the html package is an example of a ComponentView implementation that supports multiple component views of a shared model.


Field Summary
 
Fields inherited from class javax.swing.text.View sample code for javax.swing.text.View definition code for javax.swing.text.View
BadBreakWeight sample code for javax.swing.text.View.BadBreakWeight definition code for javax.swing.text.View.BadBreakWeight , ExcellentBreakWeight sample code for javax.swing.text.View.ExcellentBreakWeight definition code for javax.swing.text.View.ExcellentBreakWeight , ForcedBreakWeight sample code for javax.swing.text.View.ForcedBreakWeight definition code for javax.swing.text.View.ForcedBreakWeight , GoodBreakWeight sample code for javax.swing.text.View.GoodBreakWeight definition code for javax.swing.text.View.GoodBreakWeight , X_AXIS sample code for javax.swing.text.View.X_AXIS definition code for javax.swing.text.View.X_AXIS , Y_AXIS sample code for javax.swing.text.View.Y_AXIS definition code for javax.swing.text.View.Y_AXIS
 
Fields inherited from interface javax.swing.SwingConstants sample code for javax.swing.SwingConstants definition code for javax.swing.SwingConstants
BOTTOM sample code for javax.swing.SwingConstants.BOTTOM definition code for javax.swing.SwingConstants.BOTTOM , CENTER sample code for javax.swing.SwingConstants.CENTER definition code for javax.swing.SwingConstants.CENTER , EAST sample code for javax.swing.SwingConstants.EAST definition code for javax.swing.SwingConstants.EAST , HORIZONTAL sample code for javax.swing.SwingConstants.HORIZONTAL definition code for javax.swing.SwingConstants.HORIZONTAL , LEADING sample code for javax.swing.SwingConstants.LEADING definition code for javax.swing.SwingConstants.LEADING , LEFT sample code for javax.swing.SwingConstants.LEFT definition code for javax.swing.SwingConstants.LEFT , NEXT sample code for javax.swing.SwingConstants.NEXT definition code for javax.swing.SwingConstants.NEXT , NORTH sample code for javax.swing.SwingConstants.NORTH definition code for javax.swing.SwingConstants.NORTH , NORTH_EAST sample code for javax.swing.SwingConstants.NORTH_EAST definition code for javax.swing.SwingConstants.NORTH_EAST , NORTH_WEST sample code for javax.swing.SwingConstants.NORTH_WEST definition code for javax.swing.SwingConstants.NORTH_WEST , PREVIOUS sample code for javax.swing.SwingConstants.PREVIOUS definition code for javax.swing.SwingConstants.PREVIOUS , RIGHT sample code for javax.swing.SwingConstants.RIGHT definition code for javax.swing.SwingConstants.RIGHT , SOUTH sample code for javax.swing.SwingConstants.SOUTH definition code for javax.swing.SwingConstants.SOUTH , SOUTH_EAST sample code for javax.swing.SwingConstants.SOUTH_EAST definition code for javax.swing.SwingConstants.SOUTH_EAST , SOUTH_WEST sample code for javax.swing.SwingConstants.SOUTH_WEST definition code for javax.swing.SwingConstants.SOUTH_WEST , TOP sample code for javax.swing.SwingConstants.TOP definition code for javax.swing.SwingConstants.TOP , TRAILING sample code for javax.swing.SwingConstants.TRAILING definition code for javax.swing.SwingConstants.TRAILING , VERTICAL sample code for javax.swing.SwingConstants.VERTICAL definition code for javax.swing.SwingConstants.VERTICAL , WEST sample code for javax.swing.SwingConstants.WEST definition code for javax.swing.SwingConstants.WEST
 
Constructor Summary
ComponentView sample code for javax.swing.text.ComponentView.ComponentView(javax.swing.text.Element) definition code for javax.swing.text.ComponentView.ComponentView(javax.swing.text.Element) (Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element  elem)
          Creates a new ComponentView object.
 
Method Summary
protected  Component sample code for java.awt.Component definition code for java.awt.Component createComponent sample code for javax.swing.text.ComponentView.createComponent() definition code for javax.swing.text.ComponentView.createComponent() ()
          Create the component that is associated with this view.
 float getAlignment sample code for javax.swing.text.ComponentView.getAlignment(int) definition code for javax.swing.text.ComponentView.getAlignment(int) (int axis)
          Determines the desired alignment for this view along an axis.
 Component sample code for java.awt.Component definition code for java.awt.Component getComponent sample code for javax.swing.text.ComponentView.getComponent() definition code for javax.swing.text.ComponentView.getComponent() ()
          Fetch the component associated with the view.
 float getMaximumSpan sample code for javax.swing.text.ComponentView.getMaximumSpan(int) definition code for javax.swing.text.ComponentView.getMaximumSpan(int) (int axis)
          Determines the maximum span for this view along an axis.
 float getMinimumSpan sample code for javax.swing.text.ComponentView.getMinimumSpan(int) definition code for javax.swing.text.ComponentView.getMinimumSpan(int) (int axis)
          Determines the minimum span for this view along an axis.
 float getPreferredSpan sample code for javax.swing.text.ComponentView.getPreferredSpan(int) definition code for javax.swing.text.ComponentView.getPreferredSpan(int) (int axis)
          Determines the preferred span for this view along an axis.
 Shape sample code for java.awt.Shape definition code for java.awt.Shape modelToView sample code for javax.swing.text.ComponentView.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias) definition code for javax.swing.text.ComponentView.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias) (int pos, Shape sample code for java.awt.Shape definition code for java.awt.Shape  a, Position.Bias sample code for javax.swing.text.Position.Bias definition code for javax.swing.text.Position.Bias  b)
          Provides a mapping from the coordinate space of the model to that of the view.
 void paint sample code for javax.swing.text.ComponentView.paint(java.awt.Graphics, java.awt.Shape) definition code for javax.swing.text.ComponentView.paint(java.awt.Graphics, java.awt.Shape) (Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics  g, Shape sample code for java.awt.Shape definition code for java.awt.Shape  a)
          The real paint behavior occurs naturally from the association that the component has with its parent container (the same container hosting this view).
 void setParent sample code for javax.swing.text.ComponentView.setParent(javax.swing.text.View) definition code for javax.swing.text.ComponentView.setParent(javax.swing.text.View) (View sample code for javax.swing.text.View definition code for javax.swing.text.View  p)
          Sets the parent for a child view.
 int viewToModel sample code for javax.swing.text.ComponentView.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.ComponentView.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) (float x, float y, Shape sample code for java.awt.Shape definition code for java.awt.Shape  a, Position.Bias sample code for javax.swing.text.Position.Bias definition code for javax.swing.text.Position.Bias [] bias)
          Provides a mapping from the view coordinate space to the logical coordinate space of the model.
 
Methods inherited from class javax.swing.text.View sample code for javax.swing.text.View definition code for javax.swing.text.View
append sample code for javax.swing.text.View.append(javax.swing.text.View) definition code for javax.swing.text.View.append(javax.swing.text.View) , breakView sample code for javax.swing.text.View.breakView(int, int, float, float) definition code for javax.swing.text.View.breakView(int, int, float, float) , changedUpdate sample code for javax.swing.text.View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) , createFragment sample code for javax.swing.text.View.createFragment(int, int) definition code for javax.swing.text.View.createFragment(int, int) , forwardUpdate sample code for javax.swing.text.View.forwardUpdate(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.forwardUpdate(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) , forwardUpdateToView sample code for javax.swing.text.View.forwardUpdateToView(javax.swing.text.View, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.forwardUpdateToView(javax.swing.text.View, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) , getAttributes sample code for javax.swing.text.View.getAttributes() definition code for javax.swing.text.View.getAttributes() , getBreakWeight sample code for javax.swing.text.View.getBreakWeight(int, float, float) definition code for javax.swing.text.View.getBreakWeight(int, float, float) , getChildAllocation sample code for javax.swing.text.View.getChildAllocation(int, java.awt.Shape) definition code for javax.swing.text.View.getChildAllocation(int, java.awt.Shape) , getContainer sample code for javax.swing.text.View.getContainer() definition code for javax.swing.text.View.getContainer() , getDocument sample code for javax.swing.text.View.getDocument() definition code for javax.swing.text.View.getDocument() , getElement sample code for javax.swing.text.View.getElement() definition code for javax.swing.text.View.getElement() , getEndOffset sample code for javax.swing.text.View.getEndOffset() definition code for javax.swing.text.View.getEndOffset() , getGraphics sample code for javax.swing.text.View.getGraphics() definition code for javax.swing.text.View.getGraphics() , getNextVisualPositionFrom sample code for javax.swing.text.View.getNextVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.View.getNextVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) , getParent sample code for javax.swing.text.View.getParent() definition code for javax.swing.text.View.getParent() , getResizeWeight sample code for javax.swing.text.View.getResizeWeight(int) definition code for javax.swing.text.View.getResizeWeight(int) , getStartOffset sample code for javax.swing.text.View.getStartOffset() definition code for javax.swing.text.View.getStartOffset() , getToolTipText sample code for javax.swing.text.View.getToolTipText(float, float, java.awt.Shape) definition code for javax.swing.text.View.getToolTipText(float, float, java.awt.Shape) , getView sample code for javax.swing.text.View.getView(int) definition code for javax.swing.text.View.getView(int) , getViewCount sample code for javax.swing.text.View.getViewCount() definition code for javax.swing.text.View.getViewCount() , getViewFactory sample code for javax.swing.text.View.getViewFactory() definition code for javax.swing.text.View.getViewFactory() , getViewIndex sample code for javax.swing.text.View.getViewIndex(float, float, java.awt.Shape) definition code for javax.swing.text.View.getViewIndex(float, float, java.awt.Shape) , getViewIndex sample code for javax.swing.text.View.getViewIndex(int, javax.swing.text.Position.Bias) definition code for javax.swing.text.View.getViewIndex(int, javax.swing.text.Position.Bias) , insert sample code for javax.swing.text.View.insert(int, javax.swing.text.View) definition code for javax.swing.text.View.insert(int, javax.swing.text.View) , insertUpdate sample code for javax.swing.text.View.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) , isVisible sample code for javax.swing.text.View.isVisible() definition code for javax.swing.text.View.isVisible() , modelToView sample code for javax.swing.text.View.modelToView(int, javax.swing.text.Position.Bias, int, javax.swing.text.Position.Bias, java.awt.Shape) definition code for javax.swing.text.View.modelToView(int, javax.swing.text.Position.Bias, int, javax.swing.text.Position.Bias, java.awt.Shape) , modelToView sample code for javax.swing.text.View.modelToView(int, java.awt.Shape) definition code for javax.swing.text.View.modelToView(int, java.awt.Shape) , preferenceChanged sample code for javax.swing.text.View.preferenceChanged(javax.swing.text.View, boolean, boolean) definition code for javax.swing.text.View.preferenceChanged(javax.swing.text.View, boolean, boolean) , remove sample code for javax.swing.text.View.remove(int) definition code for javax.swing.text.View.remove(int) , removeAll sample code for javax.swing.text.View.removeAll() definition code for javax.swing.text.View.removeAll() , removeUpdate sample code for javax.swing.text.View.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) , replace sample code for javax.swing.text.View.replace(int, int, javax.swing.text.View[]) definition code for javax.swing.text.View.replace(int, int, javax.swing.text.View[]) , setSize sample code for javax.swing.text.View.setSize(float, float) definition code for javax.swing.text.View.setSize(float, float) , updateChildren sample code for javax.swing.text.View.updateChildren(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.updateChildren(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, javax.swing.text.ViewFactory) , updateLayout sample code for javax.swing.text.View.updateLayout(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape) definition code for javax.swing.text.View.updateLayout(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape) , viewToModel sample code for javax.swing.text.View.viewToModel(float, float, java.awt.Shape) definition code for javax.swing.text.View.viewToModel(float, float, java.awt.Shape)
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

ComponentView sample code for javax.swing.text.ComponentView(javax.swing.text.Element) definition code for javax.swing.text.ComponentView(javax.swing.text.Element)

public ComponentView(Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element  elem)
Creates a new ComponentView object.

Parameters:
elem - the element to decorate
Method Detail

createComponent sample code for javax.swing.text.ComponentView.createComponent() definition code for javax.swing.text.ComponentView.createComponent()

protected Component sample code for java.awt.Component definition code for java.awt.Component  createComponent()
Create the component that is associated with this view. This will be called when it has been determined that a new component is needed. This would result from a call to setParent or as a result of being notified that attributes have changed.


getComponent sample code for javax.swing.text.ComponentView.getComponent() definition code for javax.swing.text.ComponentView.getComponent()

public final Component sample code for java.awt.Component definition code for java.awt.Component  getComponent()
Fetch the component associated with the view.


paint sample code for javax.swing.text.ComponentView.paint(java.awt.Graphics, java.awt.Shape) definition code for javax.swing.text.ComponentView.paint(java.awt.Graphics, java.awt.Shape)

public void paint(Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics  g,
                  Shape sample code for java.awt.Shape definition code for java.awt.Shape  a)
The real paint behavior occurs naturally from the association that the component has with its parent container (the same container hosting this view). This is implemented to do nothing.

Specified by:
paint sample code for javax.swing.text.View.paint(java.awt.Graphics, java.awt.Shape) definition code for javax.swing.text.View.paint(java.awt.Graphics, java.awt.Shape) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
g - the graphics context
a - the shape
See Also:
View.paint(java.awt.Graphics, java.awt.Shape) sample code for javax.swing.text.View.paint(java.awt.Graphics, java.awt.Shape) definition code for javax.swing.text.View.paint(java.awt.Graphics, java.awt.Shape)

getPreferredSpan sample code for javax.swing.text.ComponentView.getPreferredSpan(int) definition code for javax.swing.text.ComponentView.getPreferredSpan(int)

public float getPreferredSpan(int axis)
Determines the preferred span for this view along an axis. This is implemented to return the value returned by Component.getPreferredSize along the axis of interest.

Specified by:
getPreferredSpan sample code for javax.swing.text.View.getPreferredSpan(int) definition code for javax.swing.text.View.getPreferredSpan(int) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
axis - may be either View.X_AXIS or View.Y_AXIS
Returns:
the span the view would like to be rendered into >= 0. Typically the view is told to render into the span that is returned, although there is no guarantee. The parent may choose to resize or break the view.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - for an invalid axis
See Also:
View.getPreferredSpan(int) sample code for javax.swing.text.View.getPreferredSpan(int) definition code for javax.swing.text.View.getPreferredSpan(int)

getMinimumSpan sample code for javax.swing.text.ComponentView.getMinimumSpan(int) definition code for javax.swing.text.ComponentView.getMinimumSpan(int)

public float getMinimumSpan(int axis)
Determines the minimum span for this view along an axis. This is implemented to return the value returned by Component.getMinimumSize along the axis of interest.

Overrides:
getMinimumSpan sample code for javax.swing.text.View.getMinimumSpan(int) definition code for javax.swing.text.View.getMinimumSpan(int) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
axis - may be either View.X_AXIS or View.Y_AXIS
Returns:
the span the view would like to be rendered into >= 0. Typically the view is told to render into the span that is returned, although there is no guarantee. The parent may choose to resize or break the view.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - for an invalid axis
See Also:
View.getPreferredSpan(int) sample code for javax.swing.text.View.getPreferredSpan(int) definition code for javax.swing.text.View.getPreferredSpan(int)

getMaximumSpan sample code for javax.swing.text.ComponentView.getMaximumSpan(int) definition code for javax.swing.text.ComponentView.getMaximumSpan(int)

public float getMaximumSpan(int axis)
Determines the maximum span for this view along an axis. This is implemented to return the value returned by Component.getMaximumSize along the axis of interest.

Overrides:
getMaximumSpan sample code for javax.swing.text.View.getMaximumSpan(int) definition code for javax.swing.text.View.getMaximumSpan(int) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
axis - may be either View.X_AXIS or View.Y_AXIS
Returns:
the span the view would like to be rendered into >= 0. Typically the view is told to render into the span that is returned, although there is no guarantee. The parent may choose to resize or break the view.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - for an invalid axis
See Also:
View.getPreferredSpan(int) sample code for javax.swing.text.View.getPreferredSpan(int) definition code for javax.swing.text.View.getPreferredSpan(int)

getAlignment sample code for javax.swing.text.ComponentView.getAlignment(int) definition code for javax.swing.text.ComponentView.getAlignment(int)

public float getAlignment(int axis)
Determines the desired alignment for this view along an axis. This is implemented to give the alignment of the embedded component.

Overrides:
getAlignment sample code for javax.swing.text.View.getAlignment(int) definition code for javax.swing.text.View.getAlignment(int) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
axis - may be either View.X_AXIS or View.Y_AXIS
Returns:
the desired alignment. This should be a value between 0.0 and 1.0 where 0 indicates alignment at the origin and 1.0 indicates alignment to the full span away from the origin. An alignment of 0.5 would be the center of the view.

setParent sample code for javax.swing.text.ComponentView.setParent(javax.swing.text.View) definition code for javax.swing.text.ComponentView.setParent(javax.swing.text.View)

public void setParent(View sample code for javax.swing.text.View definition code for javax.swing.text.View  p)
Sets the parent for a child view. The parent calls this on the child to tell it who its parent is, giving the view access to things like the hosting Container. The superclass behavior is executed, followed by a call to createComponent if the parent view parameter is non-null and a component has not yet been created. The embedded components parent is then set to the value returned by getContainer. If the parent view parameter is null, this view is being cleaned up, thus the component is removed from its parent.

The changing of the component hierarchy will touch the component lock, which is the one thing that is not safe from the View hierarchy. Therefore, this functionality is executed immediately if on the event thread, or is queued on the event queue if called from another thread (notification of change from an asynchronous update).

Overrides:
setParent sample code for javax.swing.text.View.setParent(javax.swing.text.View) definition code for javax.swing.text.View.setParent(javax.swing.text.View) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
p - the parent

modelToView sample code for javax.swing.text.ComponentView.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias) definition code for javax.swing.text.ComponentView.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias)

public Shape sample code for java.awt.Shape definition code for java.awt.Shape  modelToView(int pos,
                         Shape sample code for java.awt.Shape definition code for java.awt.Shape  a,
                         Position.Bias sample code for javax.swing.text.Position.Bias definition code for javax.swing.text.Position.Bias  b)
                  throws BadLocationException sample code for javax.swing.text.BadLocationException definition code for javax.swing.text.BadLocationException 
Provides a mapping from the coordinate space of the model to that of the view.

Specified by:
modelToView sample code for javax.swing.text.View.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias) definition code for javax.swing.text.View.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
pos - the position to convert >= 0
a - the allocated region to render into
b - the bias toward the previous character or the next character represented by the offset, in case the position is a boundary of two views; b will have one of these values:
  • Position.Bias.Forward
  • Position.Bias.Backward
Returns:
the bounding box of the given position is returned
Throws:
BadLocationException sample code for javax.swing.text.BadLocationException definition code for javax.swing.text.BadLocationException - if the given position does not represent a valid location in the associated document
See Also:
View.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias) sample code for javax.swing.text.View.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias) definition code for javax.swing.text.View.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias)

viewToModel sample code for javax.swing.text.ComponentView.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.ComponentView.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])

public int viewToModel(float x,
                       float y,
                       Shape sample code for java.awt.Shape definition code for java.awt.Shape  a,
                       Position.Bias sample code for javax.swing.text.Position.Bias definition code for javax.swing.text.Position.Bias [] bias)
Provides a mapping from the view coordinate space to the logical coordinate space of the model.

Specified by:
viewToModel sample code for javax.swing.text.View.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.View.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
x - the X coordinate >= 0
y - the Y coordinate >= 0
a - the allocated region to render into
Returns:
the location within the model that best represents the given point in the view
See Also:
View.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) sample code for javax.swing.text.View.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.View.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])