You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/09/25 21:44:10 UTC
svn commit: r818974 - in
/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra:
TerraCheckboxSkin.java TerraRadioButtonSkin.java
Author: gbrown
Date: Fri Sep 25 19:44:09 2009
New Revision: 818974
URL: http://svn.apache.org/viewvc?rev=818974&view=rev
Log:
Make the disabled state more prominent in Checkbox and RadioButton.
Modified:
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraCheckboxSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraCheckboxSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraCheckboxSkin.java?rev=818974&r1=818973&r2=818974&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraCheckboxSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraCheckboxSkin.java Fri Sep 25 19:44:09 2009
@@ -21,6 +21,7 @@
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.Graphics2D;
+import java.awt.Paint;
import java.awt.RenderingHints;
import java.awt.geom.Rectangle2D;
@@ -51,10 +52,6 @@
private Color disabledButtonBorderColor;
private Color disabledButtonSelectionColor;
- // Derived colors
- private Color buttonBevelColor;
- private Color disabledButtonBevelColor;
-
private static final int CHECKBOX_SIZE = 14;
private static final int CHECKMARK_SIZE = 10;
@@ -68,13 +65,9 @@
buttonColor = theme.getColor(4);
buttonBorderColor = theme.getColor(7);
buttonSelectionColor = theme.getColor(13);
- disabledButtonColor = theme.getColor(4);
+ disabledButtonColor = theme.getColor(3);
disabledButtonBorderColor = theme.getColor(7);
disabledButtonSelectionColor = theme.getColor(7);
-
- // Set the derived colors
- buttonBevelColor = TerraTheme.darken(buttonColor);
- disabledButtonBevelColor = disabledButtonColor;
}
@Override
@@ -179,19 +172,18 @@
}
private void paintButton(Graphics2D graphics, Checkbox checkbox, int height) {
- Color buttonColor = null;
- Color buttonBevelColor = null;
- Color buttonBorderColor = null;
- Color buttonSelectionColor = null;
+ Paint buttonPaint;
+ Color buttonBorderColor;
+ Color buttonSelectionColor;
if (checkbox.isEnabled()) {
- buttonColor = this.buttonColor;
- buttonBevelColor = this.buttonBevelColor;
+ buttonPaint = new GradientPaint(CHECKBOX_SIZE / 2, 0, TerraTheme.darken(buttonColor),
+ CHECKBOX_SIZE / 2, CHECKBOX_SIZE, buttonColor);
buttonBorderColor = this.buttonBorderColor;
buttonSelectionColor = this.buttonSelectionColor;
} else {
- buttonColor = disabledButtonColor;
- buttonBevelColor = disabledButtonBevelColor;
+ buttonPaint = disabledButtonColor;
+ System.out.println(buttonPaint);
buttonBorderColor = disabledButtonBorderColor;
buttonSelectionColor = disabledButtonSelectionColor;
}
@@ -199,8 +191,8 @@
// Center the button vertically
graphics.translate(0, (height - CHECKBOX_SIZE) / 2);
- graphics.setPaint(new GradientPaint(CHECKBOX_SIZE / 2, 0, buttonBevelColor,
- CHECKBOX_SIZE / 2, CHECKBOX_SIZE, buttonColor));
+ // Paint the background
+ graphics.setPaint(buttonPaint);
graphics.fillRect(0, 0, CHECKBOX_SIZE, CHECKBOX_SIZE);
// Paint the border
@@ -208,14 +200,15 @@
GraphicsUtilities.drawRect(graphics, 0, 0, CHECKBOX_SIZE, CHECKBOX_SIZE);
// Paint the checkmark
+ graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+
Button.State state = checkbox.getState();
if (state == Button.State.SELECTED) {
graphics.setColor(buttonSelectionColor);
graphics.setStroke(new BasicStroke(2.5f));
- graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
- RenderingHints.VALUE_ANTIALIAS_ON);
// Draw a checkmark
int n = CHECKMARK_SIZE / 2;
@@ -239,8 +232,8 @@
} else {
if (state == Button.State.MIXED) {
graphics.setColor(buttonSelectionColor);
- GraphicsUtilities.drawLine(graphics, 3, (CHECKBOX_SIZE - 3) / 2, CHECKBOX_SIZE - 7,
- Orientation.HORIZONTAL, 3);
+ GraphicsUtilities.drawLine(graphics, 4, (CHECKBOX_SIZE - 3) / 2 + 1, CHECKBOX_SIZE - 8,
+ Orientation.HORIZONTAL, 2);
}
}
}
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java?rev=818974&r1=818973&r2=818974&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java Fri Sep 25 19:44:09 2009
@@ -20,6 +20,7 @@
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
+import java.awt.Paint;
import java.awt.RadialGradientPaint;
import java.awt.RenderingHints;
import java.awt.geom.Ellipse2D;
@@ -64,7 +65,7 @@
buttonColor = theme.getColor(4);
buttonBorderColor = theme.getColor(7);
buttonSelectionColor = theme.getColor(13);
- disabledButtonColor = theme.getColor(4);
+ disabledButtonColor = theme.getColor(3);
disabledButtonBorderColor = theme.getColor(7);
disabledButtonSelectionColor = theme.getColor(7);
}
@@ -157,38 +158,39 @@
}
private void paintButton(Graphics2D graphics, RadioButton radioButton, int height) {
- Color buttonColor = null;
+ Paint buttonPaint;
Color buttonBorderColor = null;
Color buttonSelectionColor = null;
+ Ellipse2D buttonBackgroundCircle = new Ellipse2D.Double(1, 1,
+ BUTTON_DIAMETER - 3, BUTTON_DIAMETER - 3);
+
if (radioButton.isEnabled()) {
- buttonColor = this.buttonColor;
+ buttonPaint = new RadialGradientPaint((float)buttonBackgroundCircle.getCenterX(),
+ (float)buttonBackgroundCircle.getCenterY(),
+ (float)buttonBackgroundCircle.getWidth() * 2 / 3,
+ new float[] {0f, 1f}, new Color[] {TerraTheme.darken(buttonColor), buttonColor});
buttonBorderColor = this.buttonBorderColor;
buttonSelectionColor = this.buttonSelectionColor;
}
else {
- buttonColor = disabledButtonColor;
+ buttonPaint = disabledButtonColor;
buttonBorderColor = disabledButtonBorderColor;
buttonSelectionColor = disabledButtonSelectionColor;
}
- // Center the button vertically
- graphics.translate(0, (height - BUTTON_DIAMETER) / 2);
-
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
+ // Center the button vertically
+ graphics.translate(0, (height - BUTTON_DIAMETER) / 2);
+
// Paint the border
graphics.setColor(buttonBorderColor);
graphics.fillOval(0, 0, BUTTON_DIAMETER - 1, BUTTON_DIAMETER - 1);
// Paint the background
- Ellipse2D buttonBackgroundCircle = new Ellipse2D.Double(1, 1,
- BUTTON_DIAMETER - 3, BUTTON_DIAMETER - 3);
- graphics.setPaint(new RadialGradientPaint((float)buttonBackgroundCircle.getCenterX(),
- (float)buttonBackgroundCircle.getCenterY(),
- (float)buttonBackgroundCircle.getWidth() * 2 / 3,
- new float[] {0f, 1f}, new Color[] {TerraTheme.darken(buttonColor), buttonColor}));
+ graphics.setPaint(buttonPaint);
graphics.fill(buttonBackgroundCircle);
// Paint the selection