< prev index next >
src/java.desktop/share/classes/javax/swing/text/GlyphView.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -100,17 +100,19 @@
/**
* Fetch the currently installed glyph painter.
* If a painter has not yet been installed, and
* a default was not yet needed, null is returned.
+ * @return the currently installed glyph painter
*/
public GlyphPainter getGlyphPainter() {
return painter;
}
/**
* Sets the painter to use for rendering glyphs.
+ * @param p the painter to use for rendering glyphs
*/
public void setGlyphPainter(GlyphPainter p) {
painter = p;
}
@@ -142,10 +144,11 @@
* Fetch the background color to use to render the
* glyphs. If there is no background color, null should
* be returned. This is implemented to call
* <code>StyledDocument.getBackground</code> if the associated
* document is a styled document, otherwise it returns null.
+ * @return the background color to use to render the glyphs
*/
public Color getBackground() {
Document doc = getDocument();
if (doc instanceof StyledDocument) {
AttributeSet attr = getAttributes();
@@ -163,10 +166,11 @@
* <code>StyledDocument.getBackground</code> if the associated
* document is a StyledDocument. If the associated document
* is not a StyledDocument, the associated components foreground
* color is used. If there is no associated component, null
* is returned.
+ * @return the foreground color to use to render the glyphs
*/
public Color getForeground() {
Document doc = getDocument();
if (doc instanceof StyledDocument) {
AttributeSet attr = getAttributes();
@@ -185,10 +189,11 @@
* <code>StyledDocument.getFont</code> if the associated
* document is a StyledDocument. If the associated document
* is not a StyledDocument, the associated components font
* is used. If there is no associated component, null
* is returned.
+ * @return the font that the glyphs should be based upon
*/
public Font getFont() {
Document doc = getDocument();
if (doc instanceof StyledDocument) {
AttributeSet attr = getAttributes();
@@ -202,44 +207,49 @@
}
/**
* Determine if the glyphs should be underlined. If true,
* an underline should be drawn through the baseline.
+ * @return if the glyphs should be underlined
*/
public boolean isUnderline() {
AttributeSet attr = getAttributes();
return StyleConstants.isUnderline(attr);
}
/**
* Determine if the glyphs should have a strikethrough
* line. If true, a line should be drawn through the center
* of the glyphs.
+ * @return if the glyphs should have a strikethrough line
*/
public boolean isStrikeThrough() {
AttributeSet attr = getAttributes();
return StyleConstants.isStrikeThrough(attr);
}
/**
* Determine if the glyphs should be rendered as superscript.
+ * @return if the glyphs should be rendered as superscript
*/
public boolean isSubscript() {
AttributeSet attr = getAttributes();
return StyleConstants.isSubscript(attr);
}
/**
* Determine if the glyphs should be rendered as subscript.
+ * @return if the glyphs should be rendered as subscript
*/
public boolean isSuperscript() {
AttributeSet attr = getAttributes();
return StyleConstants.isSuperscript(attr);
}
/**
* Fetch the TabExpander to use if tabs are present in this view.
+ * @return the TabExpander to use if tabs are present in this view
*/
public TabExpander getTabExpander() {
return expander;
}
@@ -1146,21 +1156,47 @@
public static abstract class GlyphPainter {
/**
* Determine the span the glyphs given a start location
* (for tab expansion).
+ * @param v the {@code GlyphView}
+ * @param p0 the beginning position
+ * @param p1 the ending position
+ * @param e how to expand the tabs when encountered
+ * @param x the X coordinate
+ * @return the span the glyphs given a start location
*/
public abstract float getSpan(GlyphView v, int p0, int p1, TabExpander e, float x);
+ /**
+ * Returns of the height.
+ * @param v the {@code GlyphView}
+ * @return of the height
+ */
public abstract float getHeight(GlyphView v);
+ /**
+ * Returns of the ascent.
+ * @param v the {@code GlyphView}
+ * @return of the ascent
+ */
public abstract float getAscent(GlyphView v);
+ /**
+ * Returns of the descent.
+ * @param v the {@code GlyphView}
+ * @return of the descent
+ */
public abstract float getDescent(GlyphView v);
/**
* Paint the glyphs representing the given range.
+ * @param v the {@code GlyphView}
+ * @param g the graphics context
+ * @param a the current allocation of the view
+ * @param p0 the beginning position
+ * @param p1 the ending position
*/
public abstract void paint(GlyphView v, Graphics g, Shape a, int p0, int p1);
/**
* Provides a mapping from the document model coordinate space
@@ -1229,10 +1265,11 @@
* the painter doesn't hold any significant state, it can
* return itself. The default behavior is to return itself.
* @param v the <code>GlyphView</code> to provide a painter for
* @param p0 the starting document offset >= 0
* @param p1 the ending document offset >= p0
+ * @return a painter to use for the given GlyphView
*/
public GlyphPainter getPainter(GlyphView v, int p0, int p1) {
return this;
}
< prev index next >