You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2021/04/12 19:59:27 UTC

svn commit: r1888683 - in /pivot/trunk: tests/src/org/apache/pivot/tests/ wtk-terra/src/org/apache/pivot/wtk/skin/terra/ wtk/src/org/apache/pivot/wtk/ wtk/src/org/apache/pivot/wtk/skin/

Author: rwhitcomb
Date: Mon Apr 12 19:59:27 2021
New Revision: 1888683

URL: http://svn.apache.org/viewvc?rev=1888683&view=rev
Log:
PIVOT-1057: Add "thick" focus rectangle support to TerraTheme.
* Add the new property to theme description files.
* Add code and property to TerraTheme.
* Add new method and constants to GraphicsUtilities to select a nice "thick" stroke.
* Consolidate the determination of the focus rectangle stroke to a new method
  in ComponentSkin, which everyone calls.
* Tweak drawing in a couple of places to make the thicker focus rectangle play
  nicer with the other drawing code.

Modified:
    pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_dark_flat.json
    pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_test.json
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCheckboxSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraColorChooserButtonSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuButtonSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSpinnerSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme_dark.json
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme_default.json
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/package.html
    pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java

Modified: pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_dark_flat.json
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_dark_flat.json?rev=1888683&r1=1888682&r2=1888683&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_dark_flat.json (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_dark_flat.json Mon Apr 12 19:59:27 2021
@@ -24,6 +24,8 @@
 
     transitionEnabled: false,
 
+    thickFocusRectangle: false,
+
     colors: [
         "#f5f5f5",
         "#141414",

Modified: pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_test.json
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_test.json?rev=1888683&r1=1888682&r2=1888683&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_test.json (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/TerraTheme_test.json Mon Apr 12 19:59:27 2021
@@ -24,6 +24,8 @@
 
     transitionEnabled: false,
 
+    thickFocusRectangle: false,
+
     colors: [
         "#0a0a0a",
         "#ebebeb",

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java?rev=1888683&r1=1888682&r2=1888683&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java Mon Apr 12 19:59:27 2021
@@ -315,9 +315,7 @@ public class TerraCalendarButtonSkin ext
 
         // Paint the focus state
         if (calendarButton.isFocused()) {
-            BasicStroke dashStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
-                BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);
-            graphics.setStroke(dashStroke);
+            graphics.setStroke(getFocusRectangleStroke());
             graphics.setColor(this.borderColor);
             graphics.draw(new RoundRectangle2D.Double(2.5, 2.5, Math.max(width - 5, 0), Math.max(
                 height - 5, 0), CORNER_RADIUS / 2, CORNER_RADIUS / 2));

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCheckboxSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCheckboxSkin.java?rev=1888683&r1=1888682&r2=1888683&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCheckboxSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCheckboxSkin.java Mon Apr 12 19:59:27 2021
@@ -60,7 +60,7 @@ public class TerraCheckboxSkin extends C
         font = theme.getFont();
         color = theme.getColor(1);
         disabledColor = theme.getColor(7);
-        spacing = 3;
+        spacing = themeHasThickFocusRectangle() ? 4 : 3;
 
         buttonColor = theme.getColor(4);
         buttonBorderColor = theme.getColor(7);
@@ -174,16 +174,13 @@ public class TerraCheckboxSkin extends C
                 graphics.setColor(focusColor);
                 graphics.fillRect(0, 0, CHECKBOX_SIZE, CHECKBOX_SIZE);
             } else {
-                BasicStroke dashStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
-                    BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);
-
-                graphics.setStroke(dashStroke);
+                graphics.setStroke(getFocusRectangleStroke());
                 graphics.setColor(buttonBorderColor);
 
                 GraphicsUtilities.setAntialiasingOn(graphics);
 
-                Rectangle2D focusRectangle = new Rectangle2D.Double(CHECKBOX_SIZE + 1, 0.5,
-                    dataRenderer.getWidth() + spacing * 2 - 2, dataRenderer.getHeight() - 1);
+                Rectangle2D focusRectangle = new Rectangle2D.Double(CHECKBOX_SIZE + (spacing / 2), 0.5,
+                    dataRenderer.getWidth() + spacing, (double) dataRenderer.getHeight() - 1.5);
                 graphics.draw(focusRectangle);
             }
         }

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraColorChooserButtonSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraColorChooserButtonSkin.java?rev=1888683&r1=1888682&r2=1888683&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraColorChooserButtonSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraColorChooserButtonSkin.java Mon Apr 12 19:59:27 2021
@@ -316,9 +316,7 @@ public class TerraColorChooserButtonSkin
 
         // Paint the focus state
         if (colorChooserButton.isFocused()) {
-            BasicStroke dashStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
-                BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);
-            graphics.setStroke(dashStroke);
+            graphics.setStroke(getFocusRectangleStroke());
             graphics.setColor(this.borderColor);
             graphics.draw(new RoundRectangle2D.Double(2.5, 2.5, Math.max(width - 5, 0), Math.max(
                 height - 5, 0), CORNER_RADIUS / 2, CORNER_RADIUS / 2));

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java?rev=1888683&r1=1888682&r2=1888683&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java Mon Apr 12 19:59:27 2021
@@ -375,10 +375,7 @@ public class TerraListButtonSkin extends
 
         // Paint the focus state
         if (listButton.isFocused()) {
-            BasicStroke dashStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
-                BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);
-
-            graphics.setStroke(dashStroke);
+            graphics.setStroke(getFocusRectangleStroke());
             graphics.setColor(borderColorLocal);
 
             graphics.draw(new RoundRectangle2D.Double(2.5, 2.5,

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuButtonSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuButtonSkin.java?rev=1888683&r1=1888682&r2=1888683&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuButtonSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuButtonSkin.java Mon Apr 12 19:59:27 2021
@@ -297,9 +297,7 @@ public class TerraMenuButtonSkin extends
 
         // Paint the focus state
         if (menuButton.isFocused() && !toolbar) {
-            BasicStroke dashStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
-                BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);
-            graphics.setStroke(dashStroke);
+            graphics.setStroke(getFocusRectangleStroke());
             graphics.setColor(this.borderColor);
             graphics.draw(new RoundRectangle2D.Double(2.5, 2.5, Math.max(width - 5, 0), Math.max(
                 height - 5, 0), CORNER_RADIUS / 2, CORNER_RADIUS / 2));

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java?rev=1888683&r1=1888682&r2=1888683&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java Mon Apr 12 19:59:27 2021
@@ -250,9 +250,7 @@ public class TerraPushButtonSkin extends
 
         // Paint the focus state
         if (pushButton.isFocused() && !toolbar) {
-            BasicStroke dashStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
-                BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);
-            graphics.setStroke(dashStroke);
+            graphics.setStroke(getFocusRectangleStroke());
             graphics.setColor(this.borderColor);
             graphics.draw(new RoundRectangle2D.Double(2.5, 2.5, Math.max(width - 5, 0), Math.max(
                 height - 5, 0), CORNER_RADIUS / 2, CORNER_RADIUS / 2));

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java?rev=1888683&r1=1888682&r2=1888683&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java Mon Apr 12 19:59:27 2021
@@ -16,7 +16,6 @@
  */
 package org.apache.pivot.wtk.skin.terra;
 
-import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.Font;
 import java.awt.Graphics2D;
@@ -60,7 +59,7 @@ public class TerraRadioButtonSkin extend
         font = theme.getFont();
         color = theme.getColor(1);
         disabledColor = theme.getColor(7);
-        spacing = 3;
+        spacing = themeHasThickFocusRectangle() ? 4 : 3;
 
         buttonColor = theme.getColor(4);
         buttonBorderColor = theme.getColor(7);
@@ -172,16 +171,13 @@ public class TerraRadioButtonSkin extend
                 graphics.setColor(focusColor);
                 graphics.fillOval(0, 0, BUTTON_DIAMETER - 1, BUTTON_DIAMETER - 1);
             } else {
-                BasicStroke dashStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
-                    BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);
-
-                graphics.setStroke(dashStroke);
+                graphics.setStroke(getFocusRectangleStroke());
                 graphics.setColor(buttonBorderColor);
 
                 GraphicsUtilities.setAntialiasingOn(graphics);
 
-                Rectangle2D focusRectangle = new Rectangle2D.Double(BUTTON_DIAMETER + 1, 0.5,
-                    dataRenderer.getWidth() + spacing * 2 - 2, dataRenderer.getHeight() - 1);
+                Rectangle2D focusRectangle = new Rectangle2D.Double(BUTTON_DIAMETER + (spacing / 2), 0.5,
+                    dataRenderer.getWidth() + spacing, (double) dataRenderer.getHeight() - 1.5);
                 graphics.draw(focusRectangle);
             }
         }

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java?rev=1888683&r1=1888682&r2=1888683&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java Mon Apr 12 19:59:27 2021
@@ -16,7 +16,6 @@
  */
 package org.apache.pivot.wtk.skin.terra;
 
-import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.GradientPaint;
 import java.awt.Graphics2D;
@@ -334,9 +333,6 @@ public class TerraSliderSkin extends Sli
         }
     }
 
-    private static final BasicStroke DASH_STROKE = new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
-        BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);
-
     @Override
     public void paint(final Graphics2D graphics) {
         super.paint(graphics);
@@ -378,7 +374,7 @@ public class TerraSliderSkin extends Sli
         }
 
         if (thumb.isFocused()) {
-            graphics.setStroke(DASH_STROKE);
+            graphics.setStroke(getFocusRectangleStroke());
             graphics.setColor(buttonBorderColor);
 
             graphics.drawRect(0, 0, width - 1, height - 1);

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSpinnerSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSpinnerSkin.java?rev=1888683&r1=1888682&r2=1888683&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSpinnerSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSpinnerSkin.java Mon Apr 12 19:59:27 2021
@@ -224,10 +224,7 @@ public class TerraSpinnerSkin extends Co
 
             // Paint the focus state
             if (spinnerContentLocal.isFocused()) {
-                BasicStroke dashStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
-                    BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);
-
-                graphics.setStroke(dashStroke);
+                graphics.setStroke(getFocusRectangleStroke());
                 graphics.setColor(borderColor);
 
                 GraphicsUtilities.setAntialiasingOn(graphics);

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java?rev=1888683&r1=1888682&r2=1888683&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java Mon Apr 12 19:59:27 2021
@@ -122,6 +122,8 @@ public final class TerraTheme extends Th
     private static boolean themeIsFlat = false;
     /** Whether this theme allows animations during transitions. */
     private static boolean transitionEnabled = true;
+    /** Whether this theme draws "thick" focus rectangles. */
+    private static boolean thickFocusRectangle = true;
 
     /** What the default background of a component should be according to this theme. */
     private Color defaultBackgroundColor;
@@ -141,6 +143,8 @@ public final class TerraTheme extends Th
     public static final String THEME_IS_FLAT_PROPERTY = "themeIsFlat";
     /** Property map key for the "transitionEnabled" flag for the theme. */
     public static final String TRANSITION_ENABLED_PROPERTY = "transitionEnabled";
+    /** Property map key for the "thickFocusRectangle" flag for the theme. */
+    public static final String THICK_FOCUS_RECTANGLE_PROPERTY = "thickFocusRectangle";
     /** Property map key for the list of base colors for the theme. */
     public static final String COLORS_PROPERTY = "colors";
     /** Property map key for the name of the default styles file. */
@@ -376,6 +380,7 @@ public final class TerraTheme extends Th
             themeIsDark = properties.getBoolean(THEME_IS_DARK_PROPERTY, false);
             themeIsFlat = properties.getBoolean(THEME_IS_FLAT_PROPERTY, false);
             transitionEnabled = properties.getBoolean(TRANSITION_ENABLED_PROPERTY, true);
+            thickFocusRectangle = properties.getBoolean(THICK_FOCUS_RECTANGLE_PROPERTY, true);
 
             // For dark themes, reverse the brighten/darken multipliers so "darker" -> brighter, and vice-versa
             if (themeIsDark) {
@@ -583,6 +588,18 @@ public final class TerraTheme extends Th
     }
 
     /**
+     * Tell if the theme has thick focus rectangles, which may be more visible in some
+     * color schemes, or some screen resolutions.
+     *
+     * @return {@code true} if the focus rectangle should be thick, or {@code false}
+     * for thin (one-pixel) ones (the default for earlier versions).
+     */
+    @Override
+    public boolean isThickFocusRectangle() {
+        return thickFocusRectangle;
+    }
+
+    /**
      * Gets the image that this theme uses to represent messages of the
      * specified type.
      *

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme_dark.json
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme_dark.json?rev=1888683&r1=1888682&r2=1888683&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme_dark.json (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme_dark.json Mon Apr 12 19:59:27 2021
@@ -24,6 +24,8 @@
 
     transitionEnabled: true,
 
+    thickFocusRectangle: true,
+
     colors: [
         "#f5f5f5",
         "#141414",

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme_default.json
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme_default.json?rev=1888683&r1=1888682&r2=1888683&view=diff
==============================================================================
Binary files - no diff available.

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/package.html
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/package.html?rev=1888683&r1=1888682&r2=1888683&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/package.html (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/package.html Mon Apr 12 19:59:27 2021
@@ -54,7 +54,7 @@ The font, color palette, and message ico
 <td><code>String</code></td>
 <td>
 The default theme font; must be understandable by
-<code>java.awt.Font.decode()</code>.
+<code>org.apache.pivot.wtk.FontUtilities.decodeFont()</code>.
 </td>
 </tr>
 <tr valign="top">
@@ -94,11 +94,22 @@ Set true if enabled (default), false oth
 </td>
 </tr>
 <tr valign="top">
+<td><code>thickFocusRectangle</code></td>
+<td><code>boolean</code></td>
+<td>
+Tell if the theme should draw "thick" focus rectangles.
+The previous version default of one pixel wide dashed lines
+was not very visible on some backgrounds or at high screen
+resolutions, so thicker ones may be more suitable.
+Set true if enabled (default), false otherwise (same as previous versions).
+</td>
+</tr>
+<tr valign="top">
 <td><code>colors</code></td>
 <td><code>List&lt;String&gt;</code></td>
 <td>
 This list should contain eight colors in a form understandable by
-<code>java.awt.Color.decode()</code>. This list represents the theme's
+<code>org.apache.pivot.wtk.GraphicsUtilities.decodeColor()</code>. This list represents the theme's
 "base color palette", from which the full color palette is
 derived. Each of these eight colors will be expanded to three
 colors in the final palette: a darker version, the color itself,

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java?rev=1888683&r1=1888682&r2=1888683&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java Mon Apr 12 19:59:27 2021
@@ -16,6 +16,7 @@
  */
 package org.apache.pivot.wtk;
 
+import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.Font;
 import java.awt.GradientPaint;
@@ -111,6 +112,13 @@ public final class GraphicsUtilities {
     /** Shift value for 8 bits (or one color value). */
     private static final int ONE_BYTE = 8;
 
+    /** A "thick" focus rectangle (dashed line) stroke. */
+    private static final BasicStroke THICK_STROKE = new BasicStroke(2.5f, BasicStroke.CAP_ROUND,
+                BasicStroke.JOIN_ROUND, 1.0f, new float[] {1.0f, 4.0f}, 0.0f);
+    /** A "thin" focus rectangle (dashed line) stroke. */
+    private static final BasicStroke THIN_STROKE = new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
+                BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);
+
 
     /** Utility classes should not have public constructors. */
     private GraphicsUtilities() {
@@ -670,5 +678,20 @@ public final class GraphicsUtilities {
                 break;
         }
     }
+
+
+    /**
+     * Construct a line stroke object for a focus rectangle, in one of two styles:
+     * very thin with one pixel gaps, and a thicker one of double width and two pixel
+     * gaps.
+     *
+     * @param thick {@code true} to get the thicker style, or {@code false} to get
+     * the (default) thin one.
+     * @return The line stroke needed to draw the line(s).
+     */
+    public static BasicStroke getFocusStroke(final boolean thick) {
+        return thick ? THICK_STROKE : THIN_STROKE;
+    }
+
 }
 

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java?rev=1888683&r1=1888682&r2=1888683&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java Mon Apr 12 19:59:27 2021
@@ -250,6 +250,15 @@ public abstract class Theme {
     public abstract boolean isTransitionEnabled();
 
     /**
+     * Tell if the theme has "thick" focus rectangles, rather than a one pixel version
+     * that may be hard to distinguish in certain color schemes, or screen resolutions.
+     *
+     * @return {@code true} if thick focus rectangles should be drawn, or {@code false}
+     * for thin ones (the default in earlier versions).
+     */
+    public abstract boolean isThickFocusRectangle();
+
+    /**
      * Set appropriate default styles for the given skin object, specified by the
      * current theme.
      *

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java?rev=1888683&r1=1888682&r2=1888683&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java Mon Apr 12 19:59:27 2021
@@ -16,6 +16,7 @@
  */
 package org.apache.pivot.wtk.skin;
 
+import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.Font;
 
@@ -546,6 +547,16 @@ public abstract class ComponentSkin impl
     }
 
     /**
+     * Returns whether the current Theme has thick focus rectangles.
+     *
+     * @return {@code true} if thick focus rectangles are drawn (new default),
+     * or {@code false} otherwise (default for previous versions).
+     */
+    public final boolean themeHasThickFocusRectangle() {
+        return currentTheme().isThickFocusRectangle();
+    }
+
+    /**
      * Returns the Theme default background color.
      *
      * @return {@link Color#WHITE} if the theme is not dark
@@ -566,6 +577,16 @@ public abstract class ComponentSkin impl
     }
 
     /**
+     * Returns a dashed line stroke for drawing focus rectangles, based on
+     * the current theme setting for "thick" ones.
+     *
+     * @return A line stroke object with the correct thickness and dash pattern.
+     */
+    public final BasicStroke getFocusRectangleStroke() {
+        return GraphicsUtilities.getFocusStroke(themeHasThickFocusRectangle());
+    }
+
+    /**
      * Returns the current theme color indicated by the index value.
      *
      * @param index Index into the theme's color palette.