Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/SeparatorSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/SeparatorSkin.java?rev=1887553&r1=1887552&r2=1887553&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/SeparatorSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/SeparatorSkin.java Fri Mar 12 
21:04:51 2021
@@ -41,28 +41,33 @@ import org.apache.pivot.wtk.Theme;
  * Separator skin.
  */
 public class SeparatorSkin extends ComponentSkin implements SeparatorListener {
+    /** Current font used to render any text for the separator. */
     private Font font;
+    /** Color used to draw the separator. */
     private Color color;
+    /** Color used to paint the heading text. */
     private Color headingColor;
+    /** Thickness of the separator line. */
     private int thickness;
+    /** Padding around the separator. */
     private Insets padding;
 
+    /** Construct and set defaults. */
     public SeparatorSkin() {
     }
 
     @Override
-    public void install(Component component) {
+    public void install(final Component component) {
         super.install(component);
 
-        Theme theme = currentTheme();
-        theme.setDefaultStyles(this);
+        setDefaultStyles();
 
         Separator separator = (Separator) component;
         separator.getSeparatorListeners().add(this);
     }
 
     @Override
-    public int getPreferredWidth(int height) {
+    public int getPreferredWidth(final int height) {
         int preferredWidth = 0;
 
         Separator separator = (Separator) getComponent();
@@ -78,7 +83,7 @@ public class SeparatorSkin extends Compo
     }
 
     @Override
-    public int getPreferredHeight(int width) {
+    public int getPreferredHeight(final int width) {
         int preferredHeight = thickness;
 
         Separator separator = (Separator) getComponent();
@@ -127,7 +132,7 @@ public class SeparatorSkin extends Compo
     }
 
     @Override
-    public void paint(Graphics2D graphics) {
+    public void paint(final Graphics2D graphics) {
         Separator separator = (Separator) getComponent();
         int width = getWidth();
         int separatorY = padding.top;
@@ -173,31 +178,31 @@ public class SeparatorSkin extends Compo
     /**
      * Sets the font used in rendering the Separator's heading.
      *
-     * @param font The new font for the heading.
+     * @param newFont The new font for the heading.
      */
-    public void setFont(Font font) {
-        Utils.checkNull(font, "font");
+    public void setFont(final Font newFont) {
+        Utils.checkNull(newFont, "font");
 
-        this.font = font;
+        this.font = newFont;
         invalidateComponent();
     }
 
     /**
      * Sets the font used in rendering the Separator's heading.
      *
-     * @param font A {@linkplain ComponentSkin#decodeFont(String) font 
specification}.
+     * @param fontString A {@linkplain ComponentSkin#decodeFont(String) font 
specification}.
      */
-    public final void setFont(String font) {
-        setFont(decodeFont(font));
+    public final void setFont(final String fontString) {
+        setFont(decodeFont(fontString));
     }
 
     /**
      * Sets the font used in rendering the Separator's heading.
      *
-     * @param font A dictionary {@link Theme#deriveFont describing a font}.
+     * @param fontDictionary A dictionary {@link Theme#deriveFont describing a 
font}.
      */
-    public final void setFont(Dictionary<String, ?> font) {
-        setFont(Theme.deriveFont(font));
+    public final void setFont(final Dictionary<String, ?> fontDictionary) {
+        setFont(Theme.deriveFont(fontDictionary));
     }
 
     /**
@@ -210,23 +215,23 @@ public class SeparatorSkin extends Compo
     /**
      * Sets the color of the Separator's horizontal rule.
      *
-     * @param color The new color for the horizontal rule.
+     * @param newColor The new color for the horizontal rule.
      */
-    public void setColor(Color color) {
-        Utils.checkNull(color, "color");
+    public void setColor(final Color newColor) {
+        Utils.checkNull(newColor, "color");
 
-        this.color = color;
+        this.color = newColor;
         repaintComponent();
     }
 
     /**
      * Sets the color of the Separator's horizontal rule.
      *
-     * @param color Any of the {@linkplain GraphicsUtilities#decodeColor color
+     * @param colorString Any of the {@linkplain GraphicsUtilities#decodeColor 
color
      * values recognized by Pivot}.
      */
-    public final void setColor(String color) {
-        setColor(GraphicsUtilities.decodeColor(color, "color"));
+    public final void setColor(final String colorString) {
+        setColor(GraphicsUtilities.decodeColor(colorString, "color"));
     }
 
     /**
@@ -239,23 +244,23 @@ public class SeparatorSkin extends Compo
     /**
      * Sets the color of the text in the heading.
      *
-     * @param headingColor The new color for the heading text.
+     * @param newHeadingColor The new color for the heading text.
      */
-    public void setHeadingColor(Color headingColor) {
-        Utils.checkNull(headingColor, "headingColor");
+    public void setHeadingColor(final Color newHeadingColor) {
+        Utils.checkNull(newHeadingColor, "headingColor");
 
-        this.headingColor = headingColor;
+        this.headingColor = newHeadingColor;
         repaintComponent();
     }
 
     /**
      * Sets the color of the text in the heading.
      *
-     * @param headingColor Any of the {@linkplain GraphicsUtilities#decodeColor
+     * @param headingColorString Any of the {@linkplain 
GraphicsUtilities#decodeColor
      * color values recognized by Pivot}.
      */
-    public final void setHeadingColor(String headingColor) {
-        setHeadingColor(GraphicsUtilities.decodeColor(headingColor, 
"headingColor"));
+    public final void setHeadingColor(final String headingColorString) {
+        setHeadingColor(GraphicsUtilities.decodeColor(headingColorString, 
"headingColor"));
     }
 
     /**
@@ -268,24 +273,24 @@ public class SeparatorSkin extends Compo
     /**
      * Sets the thickness of the Separator's horizontal rule.
      *
-     * @param thickness The new rule thickness (in pixels).
+     * @param newThickness The new rule thickness (in pixels).
      */
-    public void setThickness(int thickness) {
-        Utils.checkNonNegative(thickness, "thickness");
+    public void setThickness(final int newThickness) {
+        Utils.checkNonNegative(newThickness, "thickness");
 
-        this.thickness = thickness;
+        this.thickness = newThickness;
         invalidateComponent();
     }
 
     /**
      * Sets the thickness of the Separator's horizontal rule.
      *
-     * @param thickness The new integer value for the rule thickness (in 
pixels).
+     * @param newThickness The new integer value for the rule thickness (in 
pixels).
      */
-    public final void setThickness(Number thickness) {
-        Utils.checkNull(thickness, "thickness");
+    public final void setThickness(final Number newThickness) {
+        Utils.checkNull(newThickness, "thickness");
 
-        setThickness(thickness.intValue());
+        setThickness(newThickness.intValue());
     }
 
     /**
@@ -300,12 +305,12 @@ public class SeparatorSkin extends Compo
      * Sets the amount of space to leave around the Separator's heading, and
      * above and below the entire component.
      *
-     * @param padding The new padding values.
+     * @param paddingInsets The new padding values.
      */
-    public void setPadding(Insets padding) {
-        Utils.checkNull(padding, "padding");
+    public void setPadding(final Insets paddingInsets) {
+        Utils.checkNull(paddingInsets, "padding");
 
-        this.padding = padding;
+        this.padding = paddingInsets;
         invalidateComponent();
     }
 
@@ -313,51 +318,57 @@ public class SeparatorSkin extends Compo
      * Sets the amount of space to leave around the Separator's heading, and
      * above and below the entire component.
      *
-     * @param padding A dictionary with keys in the set {left, top, bottom,
+     * @param paddingDictionary A dictionary with keys in the set {left, top, 
bottom,
      * right}.
      */
-    public final void setPadding(Dictionary<String, ?> padding) {
-        setPadding(new Insets(padding));
+    public final void setPadding(final Dictionary<String, ?> 
paddingDictionary) {
+        setPadding(new Insets(paddingDictionary));
     }
 
-    public final void setPadding(Sequence<?> padding) {
-        setPadding(new Insets(padding));
+    /**
+     * Sets the amount of space to leave around the Separator's heading, and
+     * above and below the entire component.
+     *
+     * @param paddingSequence A sequence of values in the order of [top, left, 
bottom, right].
+     */
+    public final void setPadding(final Sequence<?> paddingSequence) {
+        setPadding(new Insets(paddingSequence));
     }
 
     /**
      * Sets the amount of space to leave around the Separator's heading, and
      * above and below the entire component.
      *
-     * @param padding The new single padding value for all areas.
+     * @param paddingValue The new single padding value for all areas.
      */
-    public final void setPadding(int padding) {
-        setPadding(new Insets(padding));
+    public final void setPadding(final int paddingValue) {
+        setPadding(new Insets(paddingValue));
     }
 
     /**
      * Sets the amount of space to leave around the Separator's heading, and
      * above and below the entire component.
      *
-     * @param padding The new integer value to use for padding in all areas.
+     * @param paddingValue The new integer value to use for padding in all 
areas.
      */
-    public final void setPadding(Number padding) {
-        setPadding(new Insets(padding));
+    public final void setPadding(final Number paddingValue) {
+        setPadding(new Insets(paddingValue));
     }
 
     /**
      * Sets the amount of space to leave around the Separator's heading, and
      * above and below the entire component.
      *
-     * @param padding A string containing an integer or a JSON dictionary with
+     * @param paddingString A string containing an integer or a JSON 
dictionary with
      * keys left, top, bottom, and/or right.
      */
-    public final void setPadding(String padding) {
-        setPadding(Insets.decode(padding));
+    public final void setPadding(final String paddingString) {
+        setPadding(Insets.decode(paddingString));
     }
 
     // Separator events
     @Override
-    public void headingChanged(Separator separator, String previousHeading) {
+    public void headingChanged(final Separator separator, final String 
previousHeading) {
         invalidateComponent();
     }
 

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/SliderSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/SliderSkin.java?rev=1887553&r1=1887552&r2=1887553&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/SliderSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/SliderSkin.java Fri Mar 12 
21:04:51 2021
@@ -26,6 +26,12 @@ import org.apache.pivot.wtk.SliderValueL
  */
 public abstract class SliderSkin extends ContainerSkin implements 
SliderListener,
     SliderValueListener {
+
+    /** @return The slider component we are attached to. */
+    public Slider getSlider() {
+        return (Slider) getComponent();
+    }
+
     @Override
     public void install(final Component component) {
         super.install(component);

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java?rev=1887553&r1=1887552&r2=1887553&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java Fri Mar 12 
21:04:51 2021
@@ -56,24 +56,28 @@ import org.apache.pivot.wtk.Theme;
  */
 public class TextAreaSkin extends ComponentSkin implements TextArea.Skin, 
TextAreaListener,
     TextAreaContentListener, TextAreaSelectionListener {
-    /** Callback to blink the caret waiting for input. */
+    /**
+     * Callback to blink the caret waiting for input.
+     */
     private class BlinkCaretCallback implements Runnable {
         @Override
         public void run() {
             caretOn = !caretOn;
 
             if (selection == null) {
-                TextArea textArea = (TextArea) getComponent();
+                TextArea textArea = getTextArea();
                 textArea.repaint(caret.x, caret.y, caret.width, caret.height);
             }
         }
     }
 
-    /** Callback to scroll a selection during mouse movement. */
+    /**
+     * Callback to scroll a selection during mouse movement.
+     */
     private class ScrollSelectionCallback implements Runnable {
         @Override
         public void run() {
-            TextArea textArea = (TextArea) getComponent();
+            TextArea textArea = getTextArea();
             int selectionStart = textArea.getSelectionStart();
             int selectionLength = textArea.getSelectionLength();
             int selectionEnd = selectionStart + selectionLength - 1;
@@ -114,50 +118,94 @@ public class TextAreaSkin extends Compon
         }
     }
 
+    /** X-position of the caret/input cursor. */
     private int caretX = 0;
+    /** The current caret area. */
     private Rectangle caret = new Rectangle();
+    /** A possibly irregular selection area, often spanning multiple lines. */
     private Area selection = null;
 
+    /** Whether the caret is currently being displayed; toggled during caret 
blinking. */
     private boolean caretOn = false;
 
+    /** The anchor point set at the beginning of an area selection. */
     private int anchor = -1;
+    /** The current direction of scrolling. */
     private TextArea.ScrollDirection scrollDirection = null;
+    /** The current direction of selecting. */
     private SelectDirection selectDirection = null;
+    /** The initial mouse click X-position. */
     private int mouseX = -1;
 
+    /** The callback function used to blink the caret. */
     private BlinkCaretCallback blinkCaretCallback = new BlinkCaretCallback();
+    /** The caret blink callback currently in effect. */
     private ApplicationContext.ScheduledCallback scheduledBlinkCaretCallback = 
null;
 
+    /** The callback function used to automatically scroll. */
     private ScrollSelectionCallback scrollSelectionCallback = new 
ScrollSelectionCallback();
+    /** The scrolling callback currently in effect. */
     private ApplicationContext.ScheduledCallback 
scheduledScrollSelectionCallback = null;
 
+    /** Current font to use to display all the text. */
     private Font font;
+    /** Current foreground text color. */
     private Color color;
+    /** Current background color. */
     private Color backgroundColor;
+    /** Foreground color to display the text when the control is inactive. */
     private Color inactiveColor;
+    /** Color used to paint the currently selected area. */
     private Color selectionColor;
+    /** Background color for the selection area. */
     private Color selectionBackgroundColor;
+    /** Foreground to use to paint the selection when the control is inactive. 
*/
     private Color inactiveSelectionColor;
+    /** Background color to paint the selection when inactive. */
     private Color inactiveSelectionBackgroundColor;
+    /** Margins to use between the border of the control and the text. */
     private Insets margin;
+    /** Whether to wrap the text inside the margins. */
     private boolean wrapText;
+    /** The number of normal characters to use to represent a tab. */
     private int tabWidth;
+    /** Line width used to wrap text if greater than zero. */
     private int lineWidth;
+    /**
+     * Flag used to decide whether the {@code Enter} key is accepted to start 
a new line,
+     * or whether it is passed to the enclosing form/window (for instance, to 
accept
+     * and close the dialog).
+     */
     private boolean acceptsEnter = true;
+    /**
+     * Flag to decide whether {@code Enter} or {@code Ctrl-Enter} is used to 
enter a tab
+     * into the text, and which is used to tab among fields of the form.
+     */
     private boolean acceptsTab = false;
 
+    /**
+     * The average character size of the font, used along with {@link 
#lineWidth} to
+     * decide where to wrap the text.
+     */
     private Dimensions averageCharacterSize;
 
+    /** The actual list of paragraphs being displayed. */
     private ArrayList<TextAreaSkinParagraphView> paragraphViews = new 
ArrayList<>();
 
+    /** Constant of how many mouse clicks constitute a "double click". */
     private static final int DOUBLE_CLICK_COUNT = 2;
+    /** How many mouse clicks constitute a "triple click" (used to select 
whole lines). */
     private static final int TRIPLE_CLICK_COUNT = 3;
 
+    /** Constant milliseconds between scroll intervals. */
     private static final int SCROLL_RATE = 30;
 
+
+    /**
+     * Default constructor that sets the default colors, fonts, etc.
+     */
     public TextAreaSkin() {
-        Theme theme = currentTheme();
-        font = theme.getFont();
+        font = getThemeFont();
 
         // TODO: find a way to set this in the theme defaults.json file
         // but these conflict with the values set in TerraTextAreaSkin...
@@ -175,12 +223,16 @@ public class TextAreaSkin extends Compon
         // Remaining default styles set in the theme defaults.json file
     }
 
+    /** @return The {@code TextArea} component we are attached to. */
+    public TextArea getTextArea() {
+        return (TextArea) getComponent();
+    }
+
     @Override
     public void install(final Component component) {
         super.install(component);
 
-        Theme theme = currentTheme();
-        theme.setDefaultStyles(this);
+        setDefaultStyles();
 
         TextArea textArea = (TextArea) component;
         textArea.getTextAreaListeners().add(this);
@@ -246,7 +298,7 @@ public class TextAreaSkin extends Compon
     @SuppressWarnings("unused")
     @Override
     public void layout() {
-        TextArea textArea = (TextArea) getComponent();
+        TextArea textArea = getTextArea();
 
         int width = getWidth();
         int breakWidth = (wrapText) ? Math.max(width - margin.getWidth(), 0)
@@ -292,7 +344,7 @@ public class TextAreaSkin extends Compon
 
     @Override
     public void paint(final Graphics2D graphics) {
-        TextArea textArea = (TextArea) getComponent();
+        TextArea textArea = getTextArea();
         int width = getWidth();
         int height = getHeight();
 
@@ -389,7 +441,7 @@ public class TextAreaSkin extends Compon
                     index += paragraphView.getParagraph().getOffset();
                 }
             } else {
-                TextArea textArea = (TextArea) getComponent();
+                TextArea textArea = getTextArea();
                 int i = textArea.getParagraphAt(from);
 
                 TextAreaSkinParagraphView paragraphView = 
paragraphViews.get(i);
@@ -425,7 +477,7 @@ public class TextAreaSkin extends Compon
         int rowIndex = -1;
 
         if (paragraphViews.getLength() > 0) {
-            TextArea textArea = (TextArea) getComponent();
+            TextArea textArea = getTextArea();
             TextAreaSkinParagraphView paragraphView = 
paragraphViews.get(textArea.getParagraphAt(index));
 
             rowIndex = paragraphView.getRowAt(index - 
paragraphView.getParagraph().getOffset())
@@ -440,7 +492,7 @@ public class TextAreaSkin extends Compon
         int rowOffset = -1;
 
         if (paragraphViews.getLength() > 0) {
-            TextArea textArea = (TextArea) getComponent();
+            TextArea textArea = getTextArea();
             TextAreaSkinParagraphView paragraphView = 
paragraphViews.get(textArea.getParagraphAt(index));
 
             rowOffset = paragraphView.getRowOffset(index - 
paragraphView.getParagraph().getOffset())
@@ -455,7 +507,7 @@ public class TextAreaSkin extends Compon
         int rowLength = -1;
 
         if (paragraphViews.getLength() > 0) {
-            TextArea textArea = (TextArea) getComponent();
+            TextArea textArea = getTextArea();
             TextAreaSkinParagraphView paragraphView = 
paragraphViews.get(textArea.getParagraphAt(index));
 
             rowLength = paragraphView.getRowLength(index - 
paragraphView.getParagraph().getOffset());
@@ -480,7 +532,7 @@ public class TextAreaSkin extends Compon
         Bounds characterBounds = null;
 
         if (paragraphViews.getLength() > 0) {
-            TextArea textArea = (TextArea) getComponent();
+            TextArea textArea = getTextArea();
             TextAreaSkinParagraphView paragraphView = 
paragraphViews.get(textArea.getParagraphAt(index));
             characterBounds = paragraphView.getCharacterBounds(index
                 - paragraphView.getParagraph().getOffset());
@@ -493,6 +545,10 @@ public class TextAreaSkin extends Compon
         return characterBounds;
     }
 
+    /**
+     * @return The current selection area (can be {@code null} if nothing
+     * is selected).
+     */
     public Area getSelection() {
         return selection;
     }
@@ -501,7 +557,7 @@ public class TextAreaSkin extends Compon
         Bounds characterBounds = getCharacterBounds(index);
 
         if (characterBounds != null) {
-            TextArea textArea = (TextArea) getComponent();
+            TextArea textArea = getTextArea();
             textArea.scrollAreaToVisible(characterBounds.x, characterBounds.y,
                 characterBounds.width, characterBounds.height);
         }
@@ -515,14 +571,14 @@ public class TextAreaSkin extends Compon
     }
 
     /**
-     * Sets the font of the text.
+     * Sets the font for the text.
      *
-     * @param font The new font for the text.
+     * @param newFont The new font for the text.
      */
-    public final void setFont(final Font font) {
-        Utils.checkNull(font, "font");
+    public final void setFont(final Font newFont) {
+        Utils.checkNull(newFont, "font");
 
-        this.font = font;
+        font = newFont;
 
         averageCharacterSize = GraphicsUtilities.getAverageCharacterSize(font);
 
@@ -530,21 +586,21 @@ public class TextAreaSkin extends Compon
     }
 
     /**
-     * Sets the font of the text.
+     * Sets the font for the text.
      *
-     * @param font A {@link ComponentSkin#decodeFont(String) font 
specification}
+     * @param fontString A {@link ComponentSkin#decodeFont(String) font 
specification}
      */
-    public final void setFont(final String font) {
-        setFont(decodeFont(font));
+    public final void setFont(final String fontString) {
+        setFont(decodeFont(fontString));
     }
 
     /**
-     * Sets the font of the text.
+     * Sets the font for the text.
      *
-     * @param font A dictionary {@link Theme#deriveFont describing a font}
+     * @param fontDictionary A dictionary {@link Theme#deriveFont describing a 
font}
      */
-    public final void setFont(final Dictionary<String, ?> font) {
-        setFont(Theme.deriveFont(font));
+    public final void setFont(final Dictionary<String, ?> fontDictionary) {
+        setFont(Theme.deriveFont(fontDictionary));
     }
 
     /**
@@ -557,82 +613,82 @@ public class TextAreaSkin extends Compon
     /**
      * Sets the foreground color of the text.
      *
-     * @param color The new foreground text color.
+     * @param colorValue The new foreground text color.
      */
-    public final void setColor(final Color color) {
-        Utils.checkNull(color, "color");
+    public final void setColor(final Color colorValue) {
+        Utils.checkNull(colorValue, "color");
 
-        this.color = color;
+        color = colorValue;
         repaintComponent();
     }
 
     /**
      * Sets the foreground color of the text.
      *
-     * @param color Any of the {@linkplain GraphicsUtilities#decodeColor color
+     * @param colorString Any of the {@linkplain GraphicsUtilities#decodeColor 
color
      * values recognized by Pivot}.
      */
-    public final void setColor(final String color) {
-        setColor(GraphicsUtilities.decodeColor(color, "color"));
+    public final void setColor(final String colorString) {
+        setColor(GraphicsUtilities.decodeColor(colorString, "color"));
     }
 
     public final Color getBackgroundColor() {
         return backgroundColor;
     }
 
-    public final void setBackgroundColor(final Color backgroundColor) {
+    public final void setBackgroundColor(final Color colorValue) {
         // Null background is allowed here
-        this.backgroundColor = backgroundColor;
+        backgroundColor = colorValue;
         repaintComponent();
     }
 
-    public final void setBackgroundColor(final String backgroundColor) {
-        setBackgroundColor(GraphicsUtilities.decodeColor(backgroundColor, 
"backgroundColor"));
+    public final void setBackgroundColor(final String colorString) {
+        setBackgroundColor(GraphicsUtilities.decodeColor(colorString, 
"backgroundColor"));
     }
 
     public final Color getInactiveColor() {
         return inactiveColor;
     }
 
-    public final void setInactiveColor(final Color inactiveColor) {
-        Utils.checkNull(inactiveColor, "inactiveColor");
+    public final void setInactiveColor(final Color colorValue) {
+        Utils.checkNull(colorValue, "inactiveColor");
 
-        this.inactiveColor = inactiveColor;
+        inactiveColor = colorValue;
         repaintComponent();
     }
 
-    public final void setInactiveColor(final String inactiveColor) {
-        setColor(GraphicsUtilities.decodeColor(inactiveColor, 
"inactiveColor"));
+    public final void setInactiveColor(final String colorString) {
+        setColor(GraphicsUtilities.decodeColor(colorString, "inactiveColor"));
     }
 
     public final Color getSelectionColor() {
         return selectionColor;
     }
 
-    public final void setSelectionColor(final Color selectionColor) {
-        Utils.checkNull(selectionColor, "selectionColor");
+    public final void setSelectionColor(final Color colorValue) {
+        Utils.checkNull(colorValue, "selectionColor");
 
-        this.selectionColor = selectionColor;
+        selectionColor = colorValue;
         repaintComponent();
     }
 
-    public final void setSelectionColor(final String selectionColor) {
-        setSelectionColor(GraphicsUtilities.decodeColor(selectionColor,  
"selectionColor"));
+    public final void setSelectionColor(final String colorString) {
+        setSelectionColor(GraphicsUtilities.decodeColor(colorString,  
"selectionColor"));
     }
 
     public final Color getSelectionBackgroundColor() {
         return selectionBackgroundColor;
     }
 
-    public final void setSelectionBackgroundColor(final Color 
selectionBackgroundColor) {
-        Utils.checkNull(selectionBackgroundColor, "selectionBackgroundColor");
+    public final void setSelectionBackgroundColor(final Color colorValue) {
+        Utils.checkNull(colorValue, "selectionBackgroundColor");
 
-        this.selectionBackgroundColor = selectionBackgroundColor;
+        selectionBackgroundColor = colorValue;
         repaintComponent();
     }
 
-    public final void setSelectionBackgroundColor(final String 
selectionBackgroundColor) {
-        
setSelectionBackgroundColor(GraphicsUtilities.decodeColor(selectionBackgroundColor,
+    public final void setSelectionBackgroundColor(final String colorString) {
+        setSelectionBackgroundColor(GraphicsUtilities.decodeColor(colorString,
             "selectionBackgroundColor"));
     }
 
@@ -640,15 +696,15 @@ public class TextAreaSkin extends Compon
         return inactiveSelectionColor;
     }
 
-    public final void setInactiveSelectionColor(final Color 
inactiveSelectionColor) {
-        Utils.checkNull(inactiveSelectionColor, "inactiveSelectionColor");
+    public final void setInactiveSelectionColor(final Color colorValue) {
+        Utils.checkNull(colorValue, "inactiveSelectionColor");
 
-        this.inactiveSelectionColor = inactiveSelectionColor;
+        inactiveSelectionColor = colorValue;
         repaintComponent();
     }
 
-    public final void setInactiveSelectionColor(final String 
inactiveSelectionColor) {
-        
setInactiveSelectionColor(GraphicsUtilities.decodeColor(inactiveSelectionColor,
+    public final void setInactiveSelectionColor(final String colorString) {
+        setInactiveSelectionColor(GraphicsUtilities.decodeColor(colorString,
             "inactiveSelectionColor"));
     }
 
@@ -656,15 +712,15 @@ public class TextAreaSkin extends Compon
         return inactiveSelectionBackgroundColor;
     }
 
-    public final void setInactiveSelectionBackgroundColor(final Color 
inactiveSelectionBackgroundColor) {
-        Utils.checkNull(inactiveSelectionBackgroundColor, 
"inactiveSelectionBackgroundColor");
+    public final void setInactiveSelectionBackgroundColor(final Color 
colorValue) {
+        Utils.checkNull(colorValue, "inactiveSelectionBackgroundColor");
 
-        this.inactiveSelectionBackgroundColor = 
inactiveSelectionBackgroundColor;
+        inactiveSelectionBackgroundColor = colorValue;
         repaintComponent();
     }
 
-    public final void setInactiveSelectionBackgroundColor(final String 
inactiveSelectionBackgroundColor) {
-        
setInactiveSelectionBackgroundColor(GraphicsUtilities.decodeColor(inactiveSelectionBackgroundColor,
+    public final void setInactiveSelectionBackgroundColor(final String 
colorString) {
+        
setInactiveSelectionBackgroundColor(GraphicsUtilities.decodeColor(colorString,
             "inactiveSelectionBackgroundColor"));
     }
 
@@ -678,67 +734,67 @@ public class TextAreaSkin extends Compon
     /**
      * Sets the amount of space between the edge of the TextArea and its text.
      *
-     * @param margin The individual margin values for all edges.
+     * @param newMargin The individual margin values for all edges.
      */
-    public final void setMargin(final Insets margin) {
-        Utils.checkNull(margin, "margin");
+    public final void setMargin(final Insets newMargin) {
+        Utils.checkNull(newMargin, "margin");
 
-        this.margin = margin;
+        margin = newMargin;
         invalidateComponent();
     }
 
     /**
      * Sets the amount of space between the edge of the TextArea and its text.
      *
-     * @param margin A dictionary with keys in the set {top, left, bottom, 
right}.
+     * @param marginDictionary A dictionary with keys in the set {top, left, 
bottom, right}.
      */
-    public final void setMargin(final Dictionary<String, ?> margin) {
-        setMargin(new Insets(margin));
+    public final void setMargin(final Dictionary<String, ?> marginDictionary) {
+        setMargin(new Insets(marginDictionary));
     }
 
     /**
      * Sets the amount of space between the edge of the TextArea and its text.
      *
-     * @param margin A sequence with values in the order [top, left, bottom, 
right].
+     * @param marginSequence A sequence with values in the order [top, left, 
bottom, right].
      */
-    public final void setMargin(final Sequence<?> margin) {
-        setMargin(new Insets(margin));
+    public final void setMargin(final Sequence<?> marginSequence) {
+        setMargin(new Insets(marginSequence));
     }
 
     /**
      * Sets the amount of space between the edge of the TextArea and its text.
      *
-     * @param margin The single value to use for all the margins.
+     * @param marginValue The single value to use for all the margins.
      */
-    public final void setMargin(final int margin) {
-        setMargin(new Insets(margin));
+    public final void setMargin(final int marginValue) {
+        setMargin(new Insets(marginValue));
     }
 
     /**
      * Sets the amount of space between the edge of the TextArea and its text.
      *
-     * @param margin The single value to use for all the margins.
+     * @param marginValue The single value to use for all the margins.
      */
-    public final void setMargin(final Number margin) {
-        setMargin(new Insets(margin));
+    public final void setMargin(final Number marginValue) {
+        setMargin(new Insets(marginValue));
     }
 
     /**
      * Sets the amount of space between the edge of the TextArea and its text.
      *
-     * @param margin A string containing an integer or a JSON dictionary or 
list with
+     * @param marginString A string containing an integer or a JSON dictionary 
or list with
      * keys top, left, bottom, and/or right.
      */
-    public final void setMargin(final String margin) {
-        setMargin(Insets.decode(margin));
+    public final void setMargin(final String marginString) {
+        setMargin(Insets.decode(marginString));
     }
 
     public final boolean getWrapText() {
         return wrapText;
     }
 
-    public final void setWrapText(final boolean wrapText) {
-        this.wrapText = wrapText;
+    public final void setWrapText(final boolean wrapValue) {
+        wrapText = wrapValue;
         invalidateComponent();
     }
 
@@ -746,8 +802,8 @@ public class TextAreaSkin extends Compon
         return acceptsEnter;
     }
 
-    public final void setAcceptsEnter(final boolean acceptsEnter) {
-        this.acceptsEnter = acceptsEnter;
+    public final void setAcceptsEnter(final boolean acceptsValue) {
+        acceptsEnter = acceptsValue;
     }
 
     /**
@@ -767,13 +823,13 @@ public class TextAreaSkin extends Compon
      * Sets current value of style that determines the behavior of 
<code>TAB</code>
      * and <code>Ctrl-TAB</code> characters.
      *
-     * @param acceptsTab {@code true} if <code>TAB</code> inserts an 
appropriate
+     * @param acceptsValue {@code true} if <code>TAB</code> inserts an 
appropriate
      * number of spaces, while <code>Ctrl-TAB</code> shifts focus to next 
component.
      * {@code false} (default) means <code>TAB</code> shifts focus and
      * <code>Ctrl-TAB</code> inserts spaces.
      */
-    public final void setAcceptsTab(final boolean acceptsTab) {
-        this.acceptsTab = acceptsTab;
+    public final void setAcceptsTab(final boolean acceptsValue) {
+        acceptsTab = acceptsValue;
     }
 
     @Override
@@ -781,19 +837,19 @@ public class TextAreaSkin extends Compon
         return tabWidth;
     }
 
-    public final void setTabWidth(final int tabWidth) {
-        Utils.checkNonNegative(tabWidth, "tabWidth");
+    public final void setTabWidth(final int tabValue) {
+        Utils.checkNonNegative(tabValue, "tabWidth");
 
-        this.tabWidth = tabWidth;
+        tabWidth = tabValue;
     }
 
     public final int getLineWidth() {
         return lineWidth;
     }
 
-    public final void setLineWidth(final int lineWidth) {
-        if (this.lineWidth != lineWidth) {
-            this.lineWidth = lineWidth;
+    public final void setLineWidth(final int widthValue) {
+        if (lineWidth != widthValue) {
+            lineWidth = widthValue;
 
             int missingGlyphCode = font.getMissingGlyphCode();
             FontRenderContext fontRenderContext = 
Platform.getFontRenderContext();
@@ -815,7 +871,7 @@ public class TextAreaSkin extends Compon
         boolean consumed = super.mouseMove(component, x, y);
 
         if (Mouse.getCapturer() == component) {
-            TextArea textArea = (TextArea) getComponent();
+            TextArea textArea = getTextArea();
 
             Bounds visibleArea = textArea.getVisibleArea();
             visibleArea = new Bounds(visibleArea.x, visibleArea.y, 
visibleArea.width,
@@ -953,7 +1009,7 @@ public class TextAreaSkin extends Compon
         boolean consumed = super.keyTyped(component, character);
 
         if (paragraphViews.getLength() > 0) {
-            TextArea textArea = (TextArea) getComponent();
+            TextArea textArea = getTextArea();
 
             if (textArea.isEditable()) {
                 // Ignore characters in the control range and the ASCII delete
@@ -976,6 +1032,16 @@ public class TextAreaSkin extends Compon
         return consumed;
     }
 
+    /**
+     * Process the {@code Home} action, with appropriate modifications for the 
modifiers pressed.
+     *
+     * @param textArea The component.
+     * @param commandPressed Whether the {@code Cmd} key (platform-dependent) 
is pressed - move/select
+     * to the beginning of the text, or just the beginning of the line.
+     * @param shiftPressed Whether the {@code Shift} key is pressed - select 
or just move.
+     * @param charSelection The current selection values.
+     * @return Whether the key was actually processed (consumed).
+     */
     private boolean doHome(final TextArea textArea, final boolean 
commandPressed, final boolean shiftPressed,
         final CharSpan charSelection) {
         boolean consumed = false;
@@ -1015,6 +1081,17 @@ public class TextAreaSkin extends Compon
         return consumed;
     }
 
+    /**
+     * Process the {@code End} action, with appropriate modifications for the 
modifiers.
+     *
+     * @param textArea The component.
+     * @param commandPressed Whether the {@code Cmd} key (platform-dependent) 
is pressed - move/select
+     * to the end of the text, or just the end of the line.
+     * @param shiftPressed Whether the {@code Shift} key is pressed - select 
or just move.
+     * @param charSelection The current selection values.
+     * @param count The total character count (for {@code Cmd-End} movement).
+     * @return Whether the key was actually processed (consumed).
+     */
     private boolean doEnd(final TextArea textArea, final boolean 
commandPressed, final boolean shiftPressed,
         final CharSpan charSelection, final int count) {
         boolean consumed = false;
@@ -1063,6 +1140,16 @@ public class TextAreaSkin extends Compon
         return consumed;
     }
 
+    /**
+     * Process the {@code Left} action, with appropriate modifications for the 
modifiers.
+     *
+     * @param textArea The component.
+     * @param wordNavPressed Whether the "word navigation" modifier 
(platform-dependent) is pressed -
+     * move by words or just by characters.
+     * @param shiftPressed Whether the {@code Shift} key is pressed - select 
or just move.
+     * @param charSelection The current selection values.
+     * @return Whether the key was actually processed (consumed).
+     */
     private boolean doLeft(final TextArea textArea, final boolean 
wordNavPressed, final boolean shiftPressed,
         final CharSpan charSelection) {
         boolean consumed = false;
@@ -1136,6 +1223,17 @@ public class TextAreaSkin extends Compon
         return consumed;
     }
 
+    /**
+     * Process the {@code Right} action, with appropriate modifications for 
the modifiers.
+     *
+     * @param textArea The component.
+     * @param wordNavPressed Whether the "word navigation" modifier 
(platform-dependent) is pressed -
+     * move by words or just by characters.
+     * @param shiftPressed Whether the {@code Shift} key is pressed - select 
or just move.
+     * @param charSelection The current selection values.
+     * @param count The total count of characters to decide how far to move 
right.
+     * @return Whether the key was actually processed (consumed).
+     */
     private boolean doRight(final TextArea textArea, final boolean 
wordNavPressed, final boolean shiftPressed,
         final CharSpan charSelection, final int count) {
         boolean consumed = false;
@@ -1200,6 +1298,14 @@ public class TextAreaSkin extends Compon
         return consumed;
     }
 
+    /**
+     * Process the {@code Up} action, with appropriate modifications for the 
modifiers.
+     *
+     * @param textArea The component.
+     * @param shiftPressed Whether the {@code Shift} key is pressed - select 
or just move.
+     * @param charSelection The current selection values.
+     * @return Whether the key was actually processed (consumed).
+     */
     private boolean doUp(final TextArea textArea, final boolean shiftPressed, 
final CharSpan charSelection) {
         int start = charSelection.start;
         int length = charSelection.length;
@@ -1251,6 +1357,15 @@ public class TextAreaSkin extends Compon
         return true;
     }
 
+    /**
+     * Process the {@code Down} action, with appropriate modifications for the 
modifiers.
+     *
+     * @param textArea The component.
+     * @param shiftPressed Whether the {@code Shift} key is pressed - select 
or just move.
+     * @param charSelection The current selection values.
+     * @param count The total character count (to decide how far down to move).
+     * @return Whether the key was actually processed (consumed).
+     */
     private boolean doDown(final TextArea textArea, final boolean shiftPressed,
         final CharSpan charSelection, final int count) {
         int start = charSelection.start;
@@ -1331,6 +1446,17 @@ public class TextAreaSkin extends Compon
         return true;
     }
 
+    /**
+     * Process the (few) applicable command keys.
+     *
+     * @param textArea The component.
+     * @param keyCode Which key was pressed.
+     * @param isEditable Whether editing is allowed (allows {@code Paste} and 
{@code Undo}
+     * for instance.
+     * @param shiftPressed Shift key is pressed - affects {@code Undo}.
+     * @param count The total character count - for {@code Select All}.
+     * @return Whether the key was actually processed (consumed).
+     */
     private boolean doCommand(final TextArea textArea, final int keyCode,
         final boolean isEditable, final boolean shiftPressed, final int count) 
{
         boolean consumed = false;
@@ -1376,7 +1502,7 @@ public class TextAreaSkin extends Compon
         boolean consumed = false;
 
         if (paragraphViews.getLength() > 0) {
-            TextArea textArea = (TextArea) getComponent();
+            TextArea textArea = getTextArea();
             boolean commandPressed = 
Keyboard.isPressed(Platform.getCommandModifier());
             boolean wordNavPressed = 
Keyboard.isPressed(Platform.getWordNavigationModifier());
             boolean shiftPressed = Keyboard.isPressed(Keyboard.Modifier.SHIFT);
@@ -1468,7 +1594,7 @@ public class TextAreaSkin extends Compon
     public void focusedChanged(final Component component, final Component 
obverseComponent) {
         super.focusedChanged(component, obverseComponent);
 
-        TextArea textArea = (TextArea) getComponent();
+        TextArea textArea = getTextArea();
         if (textArea.isFocused() && textArea.getSelectionLength() == 0) {
             if (textArea.isValid()) {
                 scrollCharacterToVisible(textArea.getSelectionStart());
@@ -1557,8 +1683,11 @@ public class TextAreaSkin extends Compon
         }
     }
 
+    /**
+     * Update the displayed selection area following a selection change.
+     */
     private void updateSelection() {
-        TextArea textArea = (TextArea) getComponent();
+        TextArea textArea = getTextArea();
 
         if (paragraphViews.getLength() > 0) {
             // Update the caret
@@ -1613,6 +1742,12 @@ public class TextAreaSkin extends Compon
         }
     }
 
+    /**
+     * Process a change to the caret visibility.
+     * <p> Starts or ends the caret blink callback, as necessary.
+     *
+     * @param show Whether to show the caret or not.
+     */
     private void showCaret(final boolean show) {
         if (scheduledBlinkCaretCallback != null) {
             scheduledBlinkCaretCallback.cancel();

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java?rev=1887553&r1=1887552&r2=1887553&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java Fri Mar 12 
21:04:51 2021
@@ -274,7 +274,7 @@ org.apache.pivot.util.Console.getDefault
 
     private boolean caretOn = false;
 
-    protected boolean doingCaretCalculations = false;
+    private boolean doingCaretCalculations = false;
 
     private int anchor = -1;
     private SelectDirection selectDirection = null;
@@ -306,8 +306,7 @@ org.apache.pivot.util.Console.getDefault
     private static final int SCROLL_RATE = 30;
 
     public TextPaneSkin() {
-        Theme theme = Theme.getTheme();
-        font = theme.getFont();
+        font = getThemeFont();
 
         color = defaultForegroundColor();
         selectionBackgroundColor = defaultForegroundColor();
@@ -327,6 +326,8 @@ org.apache.pivot.util.Console.getDefault
     public void install(final Component component) {
         super.install(component);
 
+        setDefaultStyles();
+
         TextPane textPane = (TextPane) component;
         textPane.getTextPaneListeners().add(this);
         textPane.getTextPaneSelectionListeners().add(this);
@@ -550,6 +551,11 @@ org.apache.pivot.util.Console.getDefault
         return characterBounds;
     }
 
+    /** @return Current flag value that indicates we are doing caret location 
calculations. */
+    public boolean getDoingCaretCalculations() {
+        return doingCaretCalculations;
+    }
+
     /**
      * Gets current value of style that determines the behavior of 
<code>TAB</code>
      * and <code>Ctrl-TAB</code> characters.
@@ -567,13 +573,13 @@ org.apache.pivot.util.Console.getDefault
      * Sets current value of style that determines the behavior of 
<code>TAB</code>
      * and <code>Ctrl-TAB</code> characters.
      *
-     * @param acceptsTab {@code true} if <code>TAB</code> inserts an 
appropriate
+     * @param acceptsTabValue {@code true} if <code>TAB</code> inserts an 
appropriate
      * number of spaces, while <code>Ctrl-TAB</code> shifts focus to next 
component.
      * {@code false} (default) means <code>TAB</code> shifts focus and
      * <code>Ctrl-TAB</code> inserts spaces.
      */
-    public void setAcceptsTab(final boolean acceptsTab) {
-        this.acceptsTab = acceptsTab;
+    public void setAcceptsTab(final boolean acceptsTabValue) {
+        this.acceptsTab = acceptsTabValue;
     }
 
     @Override
@@ -581,10 +587,10 @@ org.apache.pivot.util.Console.getDefault
         return tabWidth;
     }
 
-    public void setTabWidth(final int tabWidth) {
-        Utils.checkNonNegative(tabWidth, "tabWidth");
+    public void setTabWidth(final int tabWidthValue) {
+        Utils.checkNonNegative(tabWidthValue, "tabWidth");
 
-        this.tabWidth = tabWidth;
+        this.tabWidth = tabWidthValue;
     }
 
     private void scrollCharacterToVisible(final int offset) {
@@ -606,31 +612,31 @@ org.apache.pivot.util.Console.getDefault
     /**
      * Sets the font of the text.
      *
-     * @param font The new font for all the text.
+     * @param newFont The new font for all the text.
      */
-    public void setFont(final Font font) {
-        Utils.checkNull(font, "font");
+    public void setFont(final Font newFont) {
+        Utils.checkNull(newFont, "font");
 
-        this.font = font;
+        this.font = newFont;
         invalidateComponent();
     }
 
     /**
      * Sets the font of the text.
      *
-     * @param font A {@link ComponentSkin#decodeFont(String) font 
specification}
+     * @param fontString A {@link ComponentSkin#decodeFont(String) font 
specification}
      */
-    public final void setFont(final String font) {
-        setFont(decodeFont(font));
+    public final void setFont(final String fontString) {
+        setFont(decodeFont(fontString));
     }
 
     /**
      * Sets the font of the text.
      *
-     * @param font A dictionary {@link Theme#deriveFont describing a font}
+     * @param fontDictionary A dictionary {@link Theme#deriveFont describing a 
font}
      */
-    public final void setFont(final Dictionary<String, ?> font) {
-        setFont(Theme.deriveFont(font));
+    public final void setFont(final Dictionary<String, ?> fontDictionary) {
+        setFont(Theme.deriveFont(fontDictionary));
     }
 
     /**
@@ -643,68 +649,68 @@ org.apache.pivot.util.Console.getDefault
     /**
      * Sets the foreground color of the text.
      *
-     * @param color The new text color.
+     * @param colorValue The new text color.
      */
-    public void setColor(final Color color) {
-        Utils.checkNull(color, "color");
+    public void setColor(final Color colorValue) {
+        Utils.checkNull(colorValue, "color");
 
-        this.color = color;
+        this.color = colorValue;
         repaintComponent();
     }
 
     /**
      * Sets the foreground color of the text.
      *
-     * @param color Any of the {@linkplain GraphicsUtilities#decodeColor color
+     * @param colorString Any of the {@linkplain GraphicsUtilities#decodeColor 
color
      * values recognized by Pivot}.
      */
-    public final void setColor(final String color) {
-        setColor(GraphicsUtilities.decodeColor(color, "color"));
+    public final void setColor(final String colorString) {
+        setColor(GraphicsUtilities.decodeColor(colorString, "color"));
     }
 
     public Color getInactiveColor() {
         return inactiveColor;
     }
 
-    public void setInactiveColor(final Color inactiveColor) {
-        Utils.checkNull(inactiveColor, "inactiveColor");
+    public void setInactiveColor(final Color inactiveColorValue) {
+        Utils.checkNull(inactiveColorValue, "inactiveColor");
 
-        this.inactiveColor = inactiveColor;
+        this.inactiveColor = inactiveColorValue;
         repaintComponent();
     }
 
-    public final void setInactiveColor(final String inactiveColor) {
-        setColor(GraphicsUtilities.decodeColor(inactiveColor, 
"inactiveColor"));
+    public final void setInactiveColor(final String inactiveColorString) {
+        setColor(GraphicsUtilities.decodeColor(inactiveColorString, 
"inactiveColor"));
     }
 
     public Color getSelectionColor() {
         return selectionColor;
     }
 
-    public void setSelectionColor(final Color selectionColor) {
-        Utils.checkNull(selectionColor, "selectionColor");
+    public void setSelectionColor(final Color selectionColorValue) {
+        Utils.checkNull(selectionColorValue, "selectionColor");
 
-        this.selectionColor = selectionColor;
+        this.selectionColor = selectionColorValue;
         repaintComponent();
     }
 
-    public final void setSelectionColor(final String selectionColor) {
-        setSelectionColor(GraphicsUtilities.decodeColor(selectionColor, 
"selectionColor"));
+    public final void setSelectionColor(final String selectionColorString) {
+        setSelectionColor(GraphicsUtilities.decodeColor(selectionColorString, 
"selectionColor"));
     }
 
     public Color getSelectionBackgroundColor() {
         return selectionBackgroundColor;
     }
 
-    public void setSelectionBackgroundColor(final Color 
selectionBackgroundColor) {
-        Utils.checkNull(selectionBackgroundColor, "selectionBackgroundColor");
+    public void setSelectionBackgroundColor(final Color 
selectionBackgroundColorValue) {
+        Utils.checkNull(selectionBackgroundColorValue, 
"selectionBackgroundColor");
 
-        this.selectionBackgroundColor = selectionBackgroundColor;
+        this.selectionBackgroundColor = selectionBackgroundColorValue;
         repaintComponent();
     }
 
-    public final void setSelectionBackgroundColor(final String 
selectionBackgroundColor) {
-        
setSelectionBackgroundColor(GraphicsUtilities.decodeColor(selectionBackgroundColor,
+    public final void setSelectionBackgroundColor(final String 
selectionBackgroundColorString) {
+        
setSelectionBackgroundColor(GraphicsUtilities.decodeColor(selectionBackgroundColorString,
             "selectionBackgroundColor"));
     }
 
@@ -712,15 +718,15 @@ org.apache.pivot.util.Console.getDefault
         return inactiveSelectionColor;
     }
 
-    public void setInactiveSelectionColor(final Color inactiveSelectionColor) {
-        Utils.checkNull(inactiveSelectionColor, "inactiveSelectionColor");
+    public void setInactiveSelectionColor(final Color 
inactiveSelectionColorValue) {
+        Utils.checkNull(inactiveSelectionColorValue, "inactiveSelectionColor");
 
-        this.inactiveSelectionColor = inactiveSelectionColor;
+        this.inactiveSelectionColor = inactiveSelectionColorValue;
         repaintComponent();
     }
 
-    public final void setInactiveSelectionColor(final String 
inactiveSelectionColor) {
-        
setInactiveSelectionColor(GraphicsUtilities.decodeColor(inactiveSelectionColor,
+    public final void setInactiveSelectionColor(final String 
inactiveSelectionColorString) {
+        
setInactiveSelectionColor(GraphicsUtilities.decodeColor(inactiveSelectionColorString,
             "inactiveSelectionColor"));
     }
 
@@ -728,15 +734,15 @@ org.apache.pivot.util.Console.getDefault
         return inactiveSelectionBackgroundColor;
     }
 
-    public void setInactiveSelectionBackgroundColor(final Color 
inactiveSelectionBackgroundColor) {
-        Utils.checkNull(inactiveSelectionBackgroundColor, 
"inactiveSelectionBackgroundColor");
+    public void setInactiveSelectionBackgroundColor(final Color 
inactiveSelectionBackgroundColorValue) {
+        Utils.checkNull(inactiveSelectionBackgroundColorValue, 
"inactiveSelectionBackgroundColor");
 
-        this.inactiveSelectionBackgroundColor = 
inactiveSelectionBackgroundColor;
+        this.inactiveSelectionBackgroundColor = 
inactiveSelectionBackgroundColorValue;
         repaintComponent();
     }
 
-    public final void setInactiveSelectionBackgroundColor(final String 
inactiveSelectionBackgroundColor) {
-        
setInactiveSelectionBackgroundColor(GraphicsUtilities.decodeColor(inactiveSelectionBackgroundColor,
+    public final void setInactiveSelectionBackgroundColor(final String 
inactiveSelectionBackgroundColorString) {
+        
setInactiveSelectionBackgroundColor(GraphicsUtilities.decodeColor(inactiveSelectionBackgroundColorString,
             "inactiveSelectionBackgroundColor"));
     }
 
@@ -750,68 +756,68 @@ org.apache.pivot.util.Console.getDefault
     /**
      * Sets the amount of space between the edge of the TextPane and its 
Document.
      *
-     * @param margin The new set of margin values.
+     * @param marginValue The new set of margin values.
      */
-    public void setMargin(final Insets margin) {
-        Utils.checkNull(margin, "margin");
+    public void setMargin(final Insets marginValue) {
+        Utils.checkNull(marginValue, "margin");
 
-        this.margin = margin;
+        this.margin = marginValue;
         invalidateComponent();
     }
 
     /**
      * Sets the amount of space between the edge of the TextPane and its 
Document.
      *
-     * @param margin A dictionary with keys in the set {top, left, bottom, 
right}.
+     * @param marginDictionary A dictionary with keys in the set {top, left, 
bottom, right}.
      */
-    public final void setMargin(final Dictionary<String, ?> margin) {
-        setMargin(new Insets(margin));
+    public final void setMargin(final Dictionary<String, ?> marginDictionary) {
+        setMargin(new Insets(marginDictionary));
     }
 
     /**
      * Sets the amount of space between the edge of the TextPane and its 
Document.
      *
-     * @param margin A sequence with values in the order [top, left, bottom, 
right].
+     * @param marginSequence A sequence with values in the order [top, left, 
bottom, right].
      */
-    public final void setMargin(final Sequence<?> margin) {
-        setMargin(new Insets(margin));
+    public final void setMargin(final Sequence<?> marginSequence) {
+        setMargin(new Insets(marginSequence));
     }
 
     /**
      * Sets the amount of space between the edge of the TextPane and its 
Document.
      *
-     * @param margin The single margin value for all edges.
+     * @param marginValue The single margin value for all edges.
      */
-    public final void setMargin(final int margin) {
-        setMargin(new Insets(margin));
+    public final void setMargin(final int marginValue) {
+        setMargin(new Insets(marginValue));
     }
 
     /**
      * Sets the amount of space between the edge of the TextPane and its 
Document.
      *
-     * @param margin The new single margin value for all the edges.
+     * @param marginValue The new single margin value for all the edges.
      */
-    public final void setMargin(final Number margin) {
-        setMargin(new Insets(margin));
+    public final void setMargin(final Number marginValue) {
+        setMargin(new Insets(marginValue));
     }
 
     /**
      * Sets the amount of space between the edge of the TextPane and its 
Document.
      *
-     * @param margin A string containing an integer or a JSON dictionary with
+     * @param marginString A string containing an integer or a JSON dictionary 
with
      * keys left, top, bottom, and/or right.
      */
-    public final void setMargin(final String margin) {
-        setMargin(Insets.decode(margin));
+    public final void setMargin(final String marginString) {
+        setMargin(Insets.decode(marginString));
     }
 
     public boolean getWrapText() {
         return wrapText;
     }
 
-    public void setWrapText(final boolean wrapText) {
-        if (this.wrapText != wrapText) {
-            this.wrapText = wrapText;
+    public void setWrapText(final boolean wrapTextValue) {
+        if (this.wrapText != wrapTextValue) {
+            this.wrapText = wrapTextValue;
 
             if (documentView != null) {
                 documentView.invalidateUpTree();
@@ -1012,6 +1018,59 @@ org.apache.pivot.util.Console.getDefault
         return null;
     }
 
+    private boolean commandKey(final TextPane textPane, final Document 
document,
+        final int keyCode, final boolean isEditable, final boolean 
shiftPressed) {
+        boolean consumed = false;
+
+        if (keyCode == Keyboard.KeyCode.A) {
+            textPane.setSelection(0, document.getCharacterCount());
+            consumed = true;
+        } else if (keyCode == Keyboard.KeyCode.C) {
+            textPane.copy();
+            consumed = true;
+        } else if (isEditable) {
+            switch (keyCode) {
+                case Keyboard.KeyCode.X:
+                    textPane.cut();
+                    consumed = true;
+                    break;
+                case Keyboard.KeyCode.V:
+                    textPane.paste();
+                    consumed = true;
+                    break;
+                case Keyboard.KeyCode.Z:
+                    if (shiftPressed) {
+                        textPane.redo();
+                    } else {
+                        textPane.undo();
+                    }
+                    consumed = true;
+                    break;
+                case Keyboard.KeyCode.ENTER:
+                    textPane.insertParagraph();
+                    consumed = true;
+                    break;
+                case Keyboard.KeyCode.DELETE:
+                    textPane.delete(false);
+                    consumed = true;
+                    break;
+                case Keyboard.KeyCode.BACKSPACE:
+                    textPane.delete(true);
+                    consumed = true;
+                    break;
+                case Keyboard.KeyCode.INSERT:
+                    if (shiftPressed) {
+                        textPane.paste();
+                        consumed = true;
+                    }
+                    break;
+                default:
+                    break;
+            }
+        }
+        return consumed;
+    }
+
     @Override
     public boolean keyPressed(final Component component, final int keyCode,
         final Keyboard.KeyLocation keyLocation) {
@@ -1030,18 +1089,12 @@ org.apache.pivot.util.Console.getDefault
         boolean isEditable = textPane.isEditable();
 
         if (document != null) {
-            if (keyCode == Keyboard.KeyCode.ENTER && isEditable) {
-                textPane.insertParagraph();
-
-                consumed = true;
-            } else if (keyCode == Keyboard.KeyCode.DELETE && isEditable) {
-                textPane.delete(false);
-
-                consumed = true;
-            } else if (keyCode == Keyboard.KeyCode.BACKSPACE && isEditable) {
-                textPane.delete(true);
-
-                consumed = true;
+            if (isEditable
+             && (keyCode == Keyboard.KeyCode.ENTER
+              || keyCode == Keyboard.KeyCode.DELETE
+              || keyCode == Keyboard.KeyCode.BACKSPACE
+              || keyCode == Keyboard.KeyCode.INSERT)) {
+                consumed = commandKey(textPane, document, keyCode, isEditable, 
shiftPressed);
             } else if (keyCode == Keyboard.KeyCode.HOME
                    || (keyCode == Keyboard.KeyCode.LEFT && metaPressed)) {
                 int start;
@@ -1054,7 +1107,6 @@ org.apache.pivot.util.Console.getDefault
                 }
 
                 if (shiftPressed) {
-
                     // TODO: if last direction was left, then extend further 
left
                     // but if right, then reverse selection from the pivot 
point
                     selectionLength += selectionStart - start;
@@ -1065,7 +1117,6 @@ org.apache.pivot.util.Console.getDefault
                 if (start >= 0) {
                     textPane.setSelection(start, selectionLength);
                     scrollCharacterToVisible(start);
-
                     consumed = true;
                 }
             } else if (keyCode == Keyboard.KeyCode.END
@@ -1095,7 +1146,6 @@ org.apache.pivot.util.Console.getDefault
                 if (selectionStart + selectionLength <= 
textPane.getCharacterCount()) {
                     textPane.setSelection(selectionStart, selectionLength);
                     scrollCharacterToVisible(selectionStart + selectionLength);
-
                     consumed = true;
                 }
             } else if (keyCode == Keyboard.KeyCode.LEFT) {
@@ -1141,7 +1191,6 @@ org.apache.pivot.util.Console.getDefault
                 scrollCharacterToVisible(selectionStart);
 
                 caretX = caret.x;
-
                 consumed = true;
             } else if (keyCode == Keyboard.KeyCode.RIGHT) {
                 if (shiftPressed) {
@@ -1187,7 +1236,6 @@ org.apache.pivot.util.Console.getDefault
 
                     caretX = caret.x;
                 }
-
                 consumed = true;
             } else if (keyCode == Keyboard.KeyCode.UP) {
                 int offset = getNextInsertionPoint(caretX, selectionStart,
@@ -1205,10 +1253,8 @@ org.apache.pivot.util.Console.getDefault
 
                 textPane.setSelection(offset, selectionLength);
                 scrollCharacterToVisible(offset);
-
                 consumed = true;
             } else if (keyCode == Keyboard.KeyCode.DOWN) {
-
                 if (shiftPressed) {
                     int from;
                     int x;
@@ -1259,7 +1305,6 @@ org.apache.pivot.util.Console.getDefault
                     textPane.setSelection(offset, 0);
                     scrollCharacterToVisible(offset);
                 }
-
                 consumed = true;
             } else if (keyCode == Keyboard.KeyCode.TAB
                 && (acceptsTab != Keyboard.isPressed(Keyboard.Modifier.CTRL))
@@ -1275,35 +1320,9 @@ org.apache.pivot.util.Console.getDefault
                     textPane.insert("\t");
                 }
                 showCaret(true);
-
                 consumed = true;
-            } else if (keyCode == Keyboard.KeyCode.INSERT) {
-                if (shiftPressed && isEditable) {
-                    textPane.paste();
-                    consumed = true;
-                }
             } else if (commandPressed) {
-                if (keyCode == Keyboard.KeyCode.A) {
-                    textPane.setSelection(0, document.getCharacterCount());
-                    consumed = true;
-                } else if (keyCode == Keyboard.KeyCode.X && isEditable) {
-                    textPane.cut();
-                    consumed = true;
-                } else if (keyCode == Keyboard.KeyCode.C) {
-                    textPane.copy();
-                    consumed = true;
-                } else if (keyCode == Keyboard.KeyCode.V && isEditable) {
-                    textPane.paste();
-                    consumed = true;
-                } else if (keyCode == Keyboard.KeyCode.Z && isEditable) {
-                    if (shiftPressed) {
-                        textPane.redo();
-                    } else {
-                        textPane.undo();
-                    }
-
-                    consumed = true;
-                }
+                consumed = commandKey(textPane, document, keyCode, isEditable, 
shiftPressed);
             } else {
                 consumed = super.keyPressed(component, keyCode, keyLocation);
             }

Modified: 
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNodeView.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNodeView.java?rev=1887553&r1=1887552&r2=1887553&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNodeView.java 
(original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNodeView.java Fri 
Mar 12 21:04:51 2021
@@ -42,8 +42,11 @@ import org.apache.pivot.wtk.text.TextSpa
  * Abstract base class for node views.
  */
 abstract class TextPaneSkinNodeView implements NodeListener {
+    /** The skin we are attached to. */
     protected final TextPaneSkin textPaneSkin;
+    /** The document node we describe. */
     private Node node = null;
+    /** Our parent view. */
     private TextPaneSkinElementView parent = null;
 
     private int width = 0;
@@ -54,9 +57,9 @@ abstract class TextPaneSkinNodeView impl
 
     private boolean valid = false;
 
-    public TextPaneSkinNodeView(final TextPaneSkin textPaneSkin, final Node 
node) {
-        this.textPaneSkin = textPaneSkin;
-        this.node = node;
+    TextPaneSkinNodeView(final TextPaneSkin textPaneSkinValue, final Node 
nodeValue) {
+        this.textPaneSkin = textPaneSkinValue;
+        this.node = nodeValue;
     }
 
     public Node getNode() {
@@ -67,8 +70,8 @@ abstract class TextPaneSkinNodeView impl
         return parent;
     }
 
-    protected void setParent(final TextPaneSkinElementView parent) {
-        this.parent = parent;
+    protected void setParent(final TextPaneSkinElementView parentValue) {
+        this.parent = parentValue;
     }
 
     protected TextPaneSkin getTextPaneSkin() {
@@ -91,23 +94,19 @@ abstract class TextPaneSkinNodeView impl
         return height;
     }
 
-    public abstract int getBaseline();
-
-    public abstract void paint(Graphics2D g);
-
     public Dimensions getSize() {
         return new Dimensions(width, height);
     }
 
-    public void setSize(final int width, final int height) {
-        assert (width >= 0);
-        assert (height >= 0);
+    public void setSize(final int widthValue, final int heightValue) {
+        assert (widthValue >= 0);
+        assert (heightValue >= 0);
 
         // Redraw the region formerly occupied by this view
         repaint();
 
-        this.width = width;
-        this.height = height;
+        this.width = widthValue;
+        this.height = heightValue;
 
         // Redraw the region currently occupied by this view
         repaint();
@@ -130,26 +129,17 @@ abstract class TextPaneSkinNodeView impl
         return new Point(x, y);
     }
 
-    protected void setLocation(final int x, final int y) {
+    protected void setLocation(final int xValue, final int yValue) {
         // Redraw the region formerly occupied by this view
         repaint();
 
-        this.x = x;
-        this.y = y;
+        this.x = xValue;
+        this.y = yValue;
 
         // Redraw the region currently occupied by this view
         repaint();
     }
 
-    /**
-     * Set location of the NodeView relative to the skin component. This is
-     * needed by the ComponentViewNode to correctly position child Component's.
-     *
-     * @param skinX the X coordinate in the skin's frame of reference
-     * @param skinY the Y coordinate in the skin's frame of reference
-     */
-    protected abstract void setSkinLocation(int skinX, int skinY);
-
     public Bounds getBounds() {
         return new Bounds(x, y, width, height);
     }
@@ -183,8 +173,13 @@ abstract class TextPaneSkinNodeView impl
         valid = false;
     }
 
+    /**
+     * Layout our children given the width to use for line breaks.
+     *
+     * @param breakWidth The width at which lines should break.
+     */
     public final void layout(final int breakWidth) {
-        // reduce the number of layout calculations we need to do by only
+        // Reduce the number of layout calculations we need to do by only
         // redoing them if necessary
         if (!valid || previousBreakWidth != breakWidth) {
             childLayout(breakWidth);
@@ -193,22 +188,44 @@ abstract class TextPaneSkinNodeView impl
         }
     }
 
-    public abstract Dimensions getPreferredSize(int breakWidth);
-
-    protected abstract void childLayout(int breakWidth);
-
+    /**
+     * @return The offset of our node relative to our parent.
+     */
     public int getOffset() {
         return node.getOffset();
     }
 
+    /**
+     * @return The offset of our node within the complete document.
+     */
     public int getDocumentOffset() {
         return (parent == null) ? 0 : parent.getDocumentOffset() + getOffset();
     }
 
+    /**
+     * @return The character count of our node.
+     */
     public int getCharacterCount() {
         return node.getCharacterCount();
     }
 
+    public abstract int getBaseline();
+
+    public abstract void paint(Graphics2D g);
+
+    /**
+     * Set location of the NodeView relative to the skin component. This is
+     * needed by the ComponentViewNode to correctly position child {@code 
Component}s.
+     *
+     * @param skinX the X coordinate in the skin's frame of reference
+     * @param skinY the Y coordinate in the skin's frame of reference
+     */
+    protected abstract void setSkinLocation(int skinX, int skinY);
+
+    public abstract Dimensions getPreferredSize(int breakWidth);
+
+    protected abstract void childLayout(int breakWidth);
+
     public abstract int getInsertionPoint(int xArgument, int yArgument);
 
     public abstract int getNextInsertionPoint(int xArgument, int from,
@@ -261,6 +278,7 @@ abstract class TextPaneSkinNodeView impl
         TextPaneSkinNodeView create(TextPaneSkin textPaneSkin, Node node);
     }
 
+    /** The map from document node classes to their associated view 
constructors. */
     private static HashMap<Class<? extends Node>, NodeCreator> 
nodeViewCreatorMap = new HashMap<>();
     static {
         nodeViewCreatorMap.put(Document.class, (textPaneSkin, node) ->
@@ -291,8 +309,6 @@ abstract class TextPaneSkinNodeView impl
      * @return The corresponding view node.
      */
     public static TextPaneSkinNodeView createNodeView(final TextPaneSkin 
textPaneSkin, final Node node) {
-        TextPaneSkinNodeView nodeView = null;
-
         NodeCreator creator = nodeViewCreatorMap.get(node.getClass());
         if (creator != null) {
             return creator.create(textPaneSkin, node);

Modified: 
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinParagraphView.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinParagraphView.java?rev=1887553&r1=1887552&r2=1887553&view=diff
==============================================================================
--- 
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinParagraphView.java 
(original)
+++ 
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinParagraphView.java 
Fri Mar 12 21:04:51 2021
@@ -24,7 +24,6 @@ import java.awt.font.LineMetrics;
 import org.apache.pivot.collections.ArrayList;
 import org.apache.pivot.wtk.Bounds;
 import org.apache.pivot.wtk.Dimensions;
-import org.apache.pivot.wtk.HorizontalAlignment;
 import org.apache.pivot.wtk.Platform;
 import org.apache.pivot.wtk.TextPane;
 import org.apache.pivot.wtk.text.Paragraph;
@@ -45,16 +44,16 @@ class TextPaneSkinParagraphView extends
         public TextPaneSkinNodeView nodeView;
         public int offset;
 
-        public RowSegment(TextPaneSkinNodeView nodeView, int offset) {
-            this.nodeView = nodeView;
-            this.offset = offset;
+        RowSegment(final TextPaneSkinNodeView nodeViewValue, final int 
offsetValue) {
+            this.nodeView = nodeViewValue;
+            this.offset = offsetValue;
         }
     }
 
     private ArrayList<Row> rows = null;
-    private Bounds terminatorBounds = new Bounds(0, 0, 0, 0);
+    private Bounds terminatorBounds = Bounds.EMPTY;
 
-    public TextPaneSkinParagraphView(TextPaneSkin textPaneSkin, Paragraph 
paragraph) {
+    TextPaneSkinParagraphView(final TextPaneSkin textPaneSkin, final Paragraph 
paragraph) {
         super(textPaneSkin, paragraph);
     }
 
@@ -65,7 +64,7 @@ class TextPaneSkinParagraphView extends
     }
 
     @Override
-    protected void childLayout(int breakWidth) {
+    protected void childLayout(final int breakWidth) {
         // Break the views into multiple rows
 
         Paragraph paragraph = (Paragraph) getNode();
@@ -136,8 +135,7 @@ class TextPaneSkinParagraphView extends
             terminatorY = layouter.rowY - terminatorHeight;
         }
 
-        terminatorBounds = new Bounds(layouter.x, terminatorY, 
PARAGRAPH_TERMINATOR_WIDTH,
-            terminatorHeight);
+        terminatorBounds = new Bounds(layouter.x, terminatorY, 
PARAGRAPH_TERMINATOR_WIDTH, terminatorHeight);
 
         // Ensure that the paragraph is visible even when empty
         layouter.paragraphWidth += terminatorBounds.width;
@@ -147,7 +145,7 @@ class TextPaneSkinParagraphView extends
     }
 
     @Override
-    public Dimensions getPreferredSize(int breakWidth) {
+    public Dimensions getPreferredSize(final int breakWidth) {
         // Break the views into multiple rows
 
         Paragraph paragraph = (Paragraph) getNode();
@@ -228,7 +226,7 @@ class TextPaneSkinParagraphView extends
         return new Dimensions(layouter.paragraphWidth, height);
     }
 
-    private static TextPaneSkinNodeView getNext(TextPaneSkinNodeView child) {
+    private static TextPaneSkinNodeView getNext(final TextPaneSkinNodeView 
child) {
         // Using instanceof checks because there is no nice place in the 
hierarchy
         // to put an abstract method
         if (child instanceof TextPaneSkinSpanView) {
@@ -251,12 +249,12 @@ class TextPaneSkinParagraphView extends
         public int paragraphWidth = 0;
         public int rowY = 0;
 
-        public void startSegment(RowSegment segment) {
+        public void startSegment(final RowSegment segment) {
             segment.nodeView.setLocation(x, segment.nodeView.getY());
             x += segment.nodeView.getWidth();
         }
 
-        public void endRow(Row row) {
+        public void endRow(final Row row) {
             row.y = rowY;
 
             // Determine the row height
@@ -285,7 +283,7 @@ class TextPaneSkinParagraphView extends
             rowY += row.height;
         }
 
-        public void end(Paragraph paragraph, ArrayList<Row> rows) {
+        public void end(final Paragraph paragraph, final ArrayList<Row> rows) {
             // calculate paragraph width
             for (Row row : rows) {
                 paragraphWidth = Math.max(paragraphWidth, row.width);
@@ -293,15 +291,18 @@ class TextPaneSkinParagraphView extends
 
             // adjust for horizontal alignment
             for (Row row : rows) {
-                if (paragraph.getHorizontalAlignment() == 
HorizontalAlignment.LEFT) {
-                    x = 0;
-                } else if (paragraph.getHorizontalAlignment() == 
HorizontalAlignment.CENTER) {
-                    x = (paragraphWidth - row.width) / 2;
-                } else if (paragraph.getHorizontalAlignment() == 
HorizontalAlignment.RIGHT) {
-                    // right alignment
-                    x = paragraphWidth - row.width;
-                } else {
-                    throw new IllegalStateException();
+                switch (paragraph.getHorizontalAlignment()) {
+                    case LEFT:
+                        x = 0;
+                        break;
+                    case CENTER:
+                        x = (paragraphWidth - row.width) / 2;
+                        break;
+                    case RIGHT:
+                        x = paragraphWidth - row.width;
+                        break;
+                    default:
+                        throw new IllegalStateException();
                 }
                 for (RowSegment segment : row.rowSegments) {
                     segment.nodeView.setLocation(x, segment.nodeView.getY());
@@ -312,24 +313,24 @@ class TextPaneSkinParagraphView extends
     }
 
     @Override
-    protected void setSkinLocation(int skinX, int skinY) {
+    protected void setSkinLocation(final int skinX, final int skinY) {
         super.setSkinLocation(skinX, skinY);
         for (int i = 0, n = rows.getLength(); i < n; i++) {
             Row row = rows.get(i);
             for (RowSegment segment : row.rowSegments) {
-                segment.nodeView.setSkinLocation(skinX + 
segment.nodeView.getX(), skinY
-                    + segment.nodeView.getY());
+                segment.nodeView.setSkinLocation(skinX + 
segment.nodeView.getX(),
+                    skinY + segment.nodeView.getY());
             }
         }
     }
 
     @Override
-    public void paint(Graphics2D graphics) {
+    public void paint(final Graphics2D graphics) {
         // The default paint() method paints the document children, but 
because of row-splitting,
         // the children we want to paint are not the same.
 
         // Determine the paint bounds
-        Bounds paintBounds = new Bounds(0, 0, getWidth(), getHeight());
+        Bounds paintBounds = new Bounds(getSize());
         Rectangle clipBounds = graphics.getClipBounds();
         if (clipBounds != null) {
             paintBounds = paintBounds.intersect(clipBounds);
@@ -344,7 +345,7 @@ class TextPaneSkinParagraphView extends
     }
 
     @Override
-    public int getInsertionPoint(int x, int y) {
+    public int getInsertionPoint(final int x, final int y) {
         int offset = -1;
 
         int n = rows.getLength();
@@ -390,7 +391,7 @@ class TextPaneSkinParagraphView extends
     }
 
     @Override
-    public int getNextInsertionPoint(int x, int from, TextPane.ScrollDirection 
direction) {
+    public int getNextInsertionPoint(final int x, final int from, final 
TextPane.ScrollDirection direction) {
         int offset = -1;
 
         int n = rows.getLength();
@@ -435,7 +436,7 @@ class TextPaneSkinParagraphView extends
 
                 for (RowSegment segment : row.rowSegments) {
                     Bounds bounds = segment.nodeView.getBounds();
-                    if (x >= bounds.x && x < bounds.x + bounds.width) {
+                    if (bounds.containsX(x)) {
                         offset = segment.nodeView.getNextInsertionPoint(
                             x - segment.nodeView.getX(), -1, direction) + 
segment.offset;
                         break;
@@ -458,7 +459,7 @@ class TextPaneSkinParagraphView extends
     }
 
     @Override
-    public int getRowAt(int offset) {
+    public int getRowAt(final int offset) {
         int rowIndex = -1;
 
         if (offset == getCharacterCount() - 1) {
@@ -487,12 +488,12 @@ class TextPaneSkinParagraphView extends
     }
 
     @Override
-    public Bounds getCharacterBounds(int offset) {
+    public Bounds getCharacterBounds(final int offset) {
         Bounds characterBounds = null;
         // This is really ugly, but *sometimes* during caret calculations we 
don't
         // want the terminator size here because it includes the composed text 
width.
         TextPaneSkin textPaneSkin = getTextPaneSkin();
-        if (offset >= getCharacterCount() - 1 && 
(!textPaneSkin.doingCaretCalculations || rows.getLength() == 0)) {
+        if (offset >= getCharacterCount() - 1 && 
(!textPaneSkin.getDoingCaretCalculations() || rows.getLength() == 0)) {
             characterBounds = terminatorBounds;
         } else {
             if (rows != null) {
@@ -506,8 +507,7 @@ class TextPaneSkinParagraphView extends
                             characterBounds = 
segment.nodeView.getCharacterBounds(offset - nodeViewOffset);
 
                             if (characterBounds != null) {
-                                characterBounds = characterBounds.translate(
-                                    segment.nodeView.getX(), 
segment.nodeView.getY());
+                                characterBounds = 
characterBounds.translate(segment.nodeView.getLocation());
                             }
 
                             break;
@@ -517,7 +517,7 @@ class TextPaneSkinParagraphView extends
             }
 
             if (characterBounds != null) {
-                characterBounds = characterBounds.intersect(0, 0, getWidth(), 
getHeight());
+                characterBounds = characterBounds.intersect(getSize());
             }
         }
 


Reply via email to