javax.swing.text
Class GlyphView
- Cloneable, SwingConstants, TabableView
Renders a run of styled text. This
View
subclass paints the
characters of the
Element
it is responsible for using
the style information from that
Element
.
BOTTOM , CENTER , EAST , HORIZONTAL , LEADING , LEFT , NEXT , NORTH , NORTH_EAST , NORTH_WEST , PREVIOUS , RIGHT , SOUTH , SOUTH_EAST , SOUTH_WEST , TOP , TRAILING , VERTICAL , WEST |
append , breakView , changedUpdate , createFragment , forwardUpdate , forwardUpdateToView , getAlignment , getAttributes , getBreakWeight , getChildAllocation , getContainer , getDocument , getElement , getEndOffset , getGraphics , getMaximumSpan , getMinimumSpan , getParent , getPreferredSpan , getResizeWeight , getStartOffset , getToolTipText , getView , getViewCount , getViewFactory , getViewIndex , getViewIndex , insert , insertUpdate , isVisible , modelToView , modelToView , paint , preferenceChanged , remove , removeAll , removeUpdate , replace , setParent , setSize , updateChildren , updateLayout , viewToModel |
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
GlyphView
public GlyphView(Element element)
Creates a new GlyphView
for the given Element
.
element
- the element that is rendered by this GlyphView
checkPainter
protected void checkPainter()
Checks if a GlyphPainer
is installed. If this is not the
case, a default painter is installed.
getBeginIndex
public int getBeginIndex()
Returns the starting offset in the document model of the portion
of text that this view is responsible for.
- the starting offset in the document model of the portion
of text that this view is responsible for
getEndIndex
public int getEndIndex()
Returns the end offset in the document model of the portion
of text that this view is responsible for.
- the end offset in the document model of the portion
of text that this view is responsible for
getFont
public Font getFont()
Returns the font for the text run for which this GlyphView
is responsible.
- the font for the text run for which this
GlyphView
is responsible
getForeground
public Color getForeground()
- the foreground color which should be used to paint the text
getGlyphPainter
public GlyphView.GlyphPainter getGlyphPainter()
Returns the GlyphPainter
that is used by this
GlyphView
. If no GlyphPainer
has been installed
null
is returned.
- the glyph painter that is used by this
glyph view or
null
if no glyph painter has been
installed
getPartialSpan
public float getPartialSpan(int p0,
int p1)
Returns the span of a portion of the view. This is used in TAB expansion
for fragments that don't contain TABs.
- getPartialSpan in interface TabableView
p0
- the start indexp1
- the end index
- the span of the specified portion of the view
getPreferredSpan
public float getPreferredSpan(int axis)
Returns the preferred span of the content managed by this
View
along the specified axis
.
- getPreferredSpan in interface View
axis
- the axis
- the preferred span of this
View
.
getTabbedSpan
public float getTabbedSpan(float x,
TabExpander te)
Returns the preferred span of this view for tab expansion.
- getTabbedSpan in interface TabableView
x
- the location of the viewte
- the tab expander to use
- the preferred span of this view for tab expansion
getText
public Segment getText(int p0,
int p1)
Returns the text segment that this view is responsible for.
p0
- the start index in the document modelp1
- the end index in the document model
- the text segment that this view is responsible for
paint
public void paint(Graphics g,
Shape a)
Renders the Element
that is associated with this
View
.
- paint in interface View
g
- the Graphics
context to render toa
- the allocated region for the Element
viewToModel
public int viewToModel(float x,
float y,
Shape a,
Position.Bias b)
Maps coordinates from the View
's space into a position
in the document model.
x
- the x coordinate in the view spacey
- the y coordinate in the view spacea
- the allocation of this View
b
- the bias to use
- the position in the document that corresponds to the screen
coordinates
x, y
GlyphView.java -- A view to render styled text
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.