This patch (committed) reformats the BasicSliderUI.java file - I'm about to do some
work on it:
2006-03-29 David Gilbert <[EMAIL PROTECTED]>
* javax/swing/plaf/basic/BasicSliderUI.java: Reformatted.
Regards,
Dave
Index: javax/swing/plaf/basic/BasicSliderUI.java
===================================================================
RCS file:
/sources/classpath/classpath/javax/swing/plaf/basic/BasicSliderUI.java,v
retrieving revision 1.25
diff -u -r1.25 BasicSliderUI.java
--- javax/swing/plaf/basic/BasicSliderUI.java 27 Mar 2006 16:00:36 -0000
1.25
+++ javax/swing/plaf/basic/BasicSliderUI.java 29 Mar 2006 09:08:12 -0000
@@ -240,13 +240,13 @@
{
// Check for orientation changes.
if (e.getPropertyName().equals("orientation"))
- recalculateIfOrientationChanged();
+ recalculateIfOrientationChanged();
else if (e.getPropertyName().equals("model"))
{
- BoundedRangeModel oldModel = (BoundedRangeModel) e.getOldValue();
- oldModel.removeChangeListener(changeListener);
- slider.getModel().addChangeListener(changeListener);
- calculateThumbLocation();
+ BoundedRangeModel oldModel = (BoundedRangeModel) e.getOldValue();
+ oldModel.removeChangeListener(changeListener);
+ slider.getModel().addChangeListener(changeListener);
+ calculateThumbLocation();
}
// elif the componentOrientation changes (this is a bound property,
@@ -308,14 +308,14 @@
{
if (! trackListener.shouldScroll(direction))
{
- scrollTimer.stop();
- return;
+ scrollTimer.stop();
+ return;
}
if (block)
- scrollByBlock(direction);
+ scrollByBlock(direction);
else
- scrollByUnit(direction);
+ scrollByUnit(direction);
}
/**
@@ -420,7 +420,8 @@
if (slider.getSnapToTicks())
value = findClosestTick(value);
- // If the thumb is hit, then we don't need to set the timers to move
it.
+ // If the thumb is hit, then we don't need to set the timers to
+ // move it.
if (! thumbRect.contains(e.getPoint()))
{
// The mouse has hit some other part of the slider.
@@ -473,14 +474,14 @@
{
int value;
if (slider.getOrientation() == JSlider.HORIZONTAL)
- value = valueForXPosition(currentMouseX);
+ value = valueForXPosition(currentMouseX);
else
- value = valueForYPosition(currentMouseY);
+ value = valueForYPosition(currentMouseY);
if (direction == POSITIVE_SCROLL)
- return (value > slider.getValue());
+ return (value > slider.getValue());
else
- return (value < slider.getValue());
+ return (value < slider.getValue());
}
}
@@ -656,35 +657,35 @@
super.installUI(c);
if (c instanceof JSlider)
{
- slider = (JSlider) c;
+ slider = (JSlider) c;
- focusRect = new Rectangle();
- contentRect = new Rectangle();
- thumbRect = new Rectangle();
- trackRect = new Rectangle();
- tickRect = new Rectangle();
- labelRect = new Rectangle();
-
- insetCache = slider.getInsets();
- leftToRightCache = ! slider.getInverted();
-
- scrollTimer = new Timer(200, null);
- scrollTimer.setRepeats(true);
-
- installDefaults(slider);
- installListeners(slider);
- installKeyboardActions(slider);
-
- calculateFocusRect();
-
- calculateContentRect();
- calculateThumbSize();
- calculateTrackBuffer();
- calculateTrackRect();
- calculateThumbLocation();
+ focusRect = new Rectangle();
+ contentRect = new Rectangle();
+ thumbRect = new Rectangle();
+ trackRect = new Rectangle();
+ tickRect = new Rectangle();
+ labelRect = new Rectangle();
+
+ insetCache = slider.getInsets();
+ leftToRightCache = ! slider.getInverted();
+
+ scrollTimer = new Timer(200, null);
+ scrollTimer.setRepeats(true);
+
+ installDefaults(slider);
+ installListeners(slider);
+ installKeyboardActions(slider);
+
+ calculateFocusRect();
+
+ calculateContentRect();
+ calculateThumbSize();
+ calculateTrackBuffer();
+ calculateTrackRect();
+ calculateThumbLocation();
- calculateTickRect();
- calculateLabelRect();
+ calculateTickRect();
+ calculateLabelRect();
}
}
@@ -914,8 +915,7 @@
// The width should cover all the labels (which are usually the
// deciding factor of the width)
int width = getWidthOfWidestLabel() * (slider.getLabelTable() == null ? 0
- :
slider.getLabelTable()
-
.size());
+ : slider.getLabelTable().size());
// If there are not enough labels.
// This number is pretty much arbitrary, but it looks nice.
@@ -1178,13 +1178,13 @@
if (slider.getOrientation() == JSlider.HORIZONTAL)
{
- thumbRect.x = xPositionForValue(value) - thumbRect.width / 2;
- thumbRect.y = trackRect.y;
+ thumbRect.x = xPositionForValue(value) - thumbRect.width / 2;
+ thumbRect.y = trackRect.y;
}
else
{
- thumbRect.x = trackRect.x;
- thumbRect.y = yPositionForValue(value) - thumbRect.height / 2;
+ thumbRect.x = trackRect.x;
+ thumbRect.y = yPositionForValue(value) - thumbRect.height / 2;
}
}
@@ -1226,14 +1226,14 @@
{
if (slider.getOrientation() == JSlider.HORIZONTAL)
{
- trackRect.x = contentRect.x + trackBuffer;
+ trackRect.x = contentRect.x + trackBuffer;
int h = getThumbSize().height;
if (slider.getPaintTicks() && (slider.getMajorTickSpacing() > 0
|| slider.getMinorTickSpacing() > 0))
h += getTickLength();
- trackRect.y = contentRect.y + (contentRect.height - h) / 2 - 1;
- trackRect.width = contentRect.width - 2 * trackBuffer;
- trackRect.height = thumbRect.height;
+ trackRect.y = contentRect.y + (contentRect.height - h) / 2 - 1;
+ trackRect.width = contentRect.width - 2 * trackBuffer;
+ trackRect.height = thumbRect.height;
}
else
{
@@ -1241,10 +1241,10 @@
if (slider.getPaintTicks() && (slider.getMajorTickSpacing() > 0
|| slider.getMinorTickSpacing() > 0))
w += getTickLength();
- trackRect.x = contentRect.x + (contentRect.width - w) / 2 - 1;
- trackRect.y = contentRect.y + trackBuffer;
- trackRect.width = thumbRect.width;
- trackRect.height = contentRect.height - 2 * trackBuffer;
+ trackRect.x = contentRect.x + (contentRect.width - w) / 2 - 1;
+ trackRect.y = contentRect.y + trackBuffer;
+ trackRect.width = thumbRect.width;
+ trackRect.height = contentRect.height - 2 * trackBuffer;
}
}
@@ -1271,23 +1271,23 @@
{
if (slider.getOrientation() == JSlider.HORIZONTAL)
{
- tickRect.x = trackRect.x;
- tickRect.y = trackRect.y + trackRect.height;
- tickRect.width = trackRect.width;
- tickRect.height = getTickLength();
+ tickRect.x = trackRect.x;
+ tickRect.y = trackRect.y + trackRect.height;
+ tickRect.width = trackRect.width;
+ tickRect.height = getTickLength();
- if (tickRect.y + tickRect.height > contentRect.y + contentRect.height)
- tickRect.height = contentRect.y + contentRect.height - tickRect.y;
+ if (tickRect.y + tickRect.height > contentRect.y + contentRect.height)
+ tickRect.height = contentRect.y + contentRect.height - tickRect.y;
}
else
{
- tickRect.x = trackRect.x + trackRect.width;
- tickRect.y = trackRect.y;
- tickRect.width = getTickLength();
- tickRect.height = trackRect.height;
+ tickRect.x = trackRect.x + trackRect.width;
+ tickRect.y = trackRect.y;
+ tickRect.width = getTickLength();
+ tickRect.height = trackRect.height;
- if (tickRect.x + tickRect.width > contentRect.x + contentRect.width)
- tickRect.width = contentRect.x + contentRect.width - tickRect.x;
+ if (tickRect.x + tickRect.width > contentRect.x + contentRect.width)
+ tickRect.width = contentRect.x + contentRect.width - tickRect.x;
}
}
@@ -1299,17 +1299,17 @@
{
if (slider.getOrientation() == JSlider.HORIZONTAL)
{
- labelRect.x = contentRect.x;
- labelRect.y = tickRect.y + tickRect.height;
- labelRect.width = contentRect.width;
- labelRect.height = contentRect.height - labelRect.y;
+ labelRect.x = contentRect.x;
+ labelRect.y = tickRect.y + tickRect.height;
+ labelRect.width = contentRect.width;
+ labelRect.height = contentRect.height - labelRect.y;
}
else
{
- labelRect.x = tickRect.x + tickRect.width;
- labelRect.y = contentRect.y;
- labelRect.width = contentRect.width - labelRect.x;
- labelRect.height = contentRect.height;
+ labelRect.x = tickRect.x + tickRect.width;
+ labelRect.y = contentRect.y;
+ labelRect.width = contentRect.width - labelRect.x;
+ labelRect.height = contentRect.height;
}
}
@@ -1331,13 +1331,13 @@
for (Enumeration list = slider.getLabelTable().elements();
list.hasMoreElements();)
{
- Object comp = list.nextElement();
- if (! (comp instanceof Component))
- continue;
- label = (Component) comp;
- pref = label.getPreferredSize();
- if (pref != null && pref.width > widest)
- widest = pref.width;
+ Object comp = list.nextElement();
+ if (! (comp instanceof Component))
+ continue;
+ label = (Component) comp;
+ pref = label.getPreferredSize();
+ if (pref != null && pref.width > widest)
+ widest = pref.width;
}
return widest;
}
@@ -1359,13 +1359,13 @@
for (Enumeration list = slider.getLabelTable().elements();
list.hasMoreElements();)
{
- Object comp = list.nextElement();
- if (! (comp instanceof Component))
- continue;
- label = (Component) comp;
- pref = label.getPreferredSize();
- if (pref != null && pref.height > tallest)
- tallest = pref.height;
+ Object comp = list.nextElement();
+ if (! (comp instanceof Component))
+ continue;
+ label = (Component) comp;
+ pref = label.getPreferredSize();
+ if (pref != null && pref.height > tallest)
+ tallest = pref.height;
}
return tallest;
}
@@ -1456,12 +1456,12 @@
for (Enumeration list = labelTable.keys(); list.hasMoreElements();)
{
- Object value = list.nextElement();
- if (! (value instanceof Integer))
- continue;
- tmpKey = (Integer) value;
- if (tmpKey.intValue() < key.intValue())
- key = tmpKey;
+ Object value = list.nextElement();
+ if (! (value instanceof Integer))
+ continue;
+ tmpKey = (Integer) value;
+ if (tmpKey.intValue() < key.intValue())
+ key = tmpKey;
}
Object comp = labelTable.get(key);
if (! (comp instanceof Component))
@@ -1485,12 +1485,12 @@
for (Enumeration list = labelTable.keys(); list.hasMoreElements();)
{
- Object value = list.nextElement();
- if (! (value instanceof Integer))
- continue;
- tmpKey = (Integer) value;
- if (tmpKey.intValue() > key.intValue())
- key = tmpKey;
+ Object value = list.nextElement();
+ if (! (value instanceof Integer))
+ continue;
+ tmpKey = (Integer) value;
+ if (tmpKey.intValue() > key.intValue())
+ key = tmpKey;
}
Object comp = labelTable.get(key);
if (! (comp instanceof Component))
@@ -1509,7 +1509,8 @@
public void paint(Graphics g, JComponent c)
{
// FIXME: Move this to propertyChangeEvent handler, when we get those.
- leftToRightCache = slider.getComponentOrientation() !=
ComponentOrientation.RIGHT_TO_LEFT;
+ leftToRightCache = slider.getComponentOrientation()
+ != ComponentOrientation.RIGHT_TO_LEFT;
// FIXME: This next line is only here because the above line is here.
calculateGeometry();
@@ -1618,23 +1619,23 @@
if (slider.getOrientation() == JSlider.HORIZONTAL)
{
- width = trackRect.width;
- height = (thumbRect.height / 4 == 0) ? 1 : thumbRect.height / 4;
+ width = trackRect.width;
+ height = (thumbRect.height / 4 == 0) ? 1 : thumbRect.height / 4;
- a.translate(0, (trackRect.height / 2) - (height / 2));
- b.translate(0, (trackRect.height / 2) + (height / 2));
- c.translate(trackRect.width, (trackRect.height / 2) + (height / 2));
- d.translate(trackRect.width, (trackRect.height / 2) - (height / 2));
+ a.translate(0, (trackRect.height / 2) - (height / 2));
+ b.translate(0, (trackRect.height / 2) + (height / 2));
+ c.translate(trackRect.width, (trackRect.height / 2) + (height / 2));
+ d.translate(trackRect.width, (trackRect.height / 2) - (height / 2));
}
else
{
- width = (thumbRect.width / 4 == 0) ? 1 : thumbRect.width / 4;
- height = trackRect.height;
+ width = (thumbRect.width / 4 == 0) ? 1 : thumbRect.width / 4;
+ height = trackRect.height;
- a.translate((trackRect.width / 2) - (width / 2), 0);
- b.translate((trackRect.width / 2) - (width / 2), trackRect.height);
- c.translate((trackRect.width / 2) + (width / 2), trackRect.height);
- d.translate((trackRect.width / 2) + (width / 2), 0);
+ a.translate((trackRect.width / 2) - (width / 2), 0);
+ b.translate((trackRect.width / 2) - (width / 2), trackRect.height);
+ c.translate((trackRect.width / 2) + (width / 2), trackRect.height);
+ d.translate((trackRect.width / 2) + (width / 2), 0);
}
g.setColor(Color.GRAY);
g.fillRect(a.x, a.y, width, height);
@@ -1666,86 +1667,86 @@
if (majorSpace > 0)
{
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- {
- double loc = tickRect.x + 0.5;
- double increment = (max == min) ? 0
- : majorSpace * (double) (tickRect.width - 1) / (max - min);
+ if (slider.getOrientation() == JSlider.HORIZONTAL)
+ {
+ double loc = tickRect.x + 0.5;
+ double increment = (max == min) ? 0
+ : majorSpace * (double) (tickRect.width - 1) / (max - min);
if (drawInverted())
- {
- loc += tickRect.width;
- increment *= -1;
- }
+ {
+ loc += tickRect.width;
+ increment *= -1;
+ }
g.translate(0, tickRect.y);
- for (int i = min; i <= max; i += majorSpace)
- {
- paintMajorTickForHorizSlider(g, tickRect, (int) loc);
- loc += increment;
- }
+ for (int i = min; i <= max; i += majorSpace)
+ {
+ paintMajorTickForHorizSlider(g, tickRect, (int) loc);
+ loc += increment;
+ }
g.translate(0, -tickRect.y);
- }
- else
- {
- double loc = tickRect.height + tickRect.y + 0.5;
- double increment = (max == min) ? 0
- : -majorSpace * (double) (tickRect.height - 1) / (max - min);
- if (drawInverted())
- {
- loc = tickRect.y + 0.5;
- increment *= -1;
- }
+ }
+ else
+ {
+ double loc = tickRect.height + tickRect.y + 0.5;
+ double increment = (max == min) ? 0
+ : -majorSpace * (double) (tickRect.height - 1) / (max - min);
+ if (drawInverted())
+ {
+ loc = tickRect.y + 0.5;
+ increment *= -1;
+ }
g.translate(tickRect.x, 0);
- for (int i = min; i <= max; i += majorSpace)
- {
- paintMajorTickForVertSlider(g, tickRect, (int) loc);
- loc += increment;
- }
+ for (int i = min; i <= max; i += majorSpace)
+ {
+ paintMajorTickForVertSlider(g, tickRect, (int) loc);
+ loc += increment;
+ }
g.translate(-tickRect.x, 0);
- }
+ }
}
if (minorSpace > 0)
{
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- {
- double loc = tickRect.x + 0.5;
- double increment = (max == min) ? 0
- : minorSpace * (double) (tickRect.width - 1) / (max - min);
- if (drawInverted())
- {
- loc += tickRect.width;
- increment *= -1;
- }
+ if (slider.getOrientation() == JSlider.HORIZONTAL)
+ {
+ double loc = tickRect.x + 0.5;
+ double increment = (max == min) ? 0
+ : minorSpace * (double) (tickRect.width - 1) / (max - min);
+ if (drawInverted())
+ {
+ loc += tickRect.width;
+ increment *= -1;
+ }
g.translate(0, tickRect.y);
- for (int i = min; i <= max; i += minorSpace)
- {
- paintMinorTickForHorizSlider(g, tickRect, (int) loc);
- loc += increment;
- }
+ for (int i = min; i <= max; i += minorSpace)
+ {
+ paintMinorTickForHorizSlider(g, tickRect, (int) loc);
+ loc += increment;
+ }
g.translate(0, -tickRect.y);
- }
- else
- {
- double loc = tickRect.height + tickRect.y + 0.5;
- double increment = (max == min) ? 0
- : -minorSpace * (double) (tickRect.height - 1) / (max - min);
- if (drawInverted())
- {
- loc = tickRect.y + 0.5;
- increment *= -1;
- }
+ }
+ else
+ {
+ double loc = tickRect.height + tickRect.y + 0.5;
+ double increment = (max == min) ? 0
+ : -minorSpace * (double) (tickRect.height - 1) / (max - min);
+ if (drawInverted())
+ {
+ loc = tickRect.y + 0.5;
+ increment *= -1;
+ }
g.translate(tickRect.x, 0);
- for (int i = min; i <= max; i += minorSpace)
- {
- paintMinorTickForVertSlider(g, tickRect, (int) loc);
- loc += increment;
- }
+ for (int i = min; i <= max; i += minorSpace)
+ {
+ paintMinorTickForVertSlider(g, tickRect, (int) loc);
+ loc += increment;
+ }
g.translate(-tickRect.x, 0);
- }
+ }
}
}
- /* Minor ticks start at 1/4 of the height (or width) of the tickRect and
extend
- to 1/2 of the tickRect.
+ /* Minor ticks start at 1/4 of the height (or width) of the tickRect and
+ extend to 1/2 of the tickRect.
Major ticks start at 1/4 of the height and extend to 3/4.
*/
@@ -1838,45 +1839,45 @@
{
if (slider.getLabelTable() != null)
{
- Dictionary table = slider.getLabelTable();
- Integer tmpKey;
- Object key;
- Object element;
- Component label;
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- {
- for (Enumeration list = table.keys(); list.hasMoreElements();)
- {
- key = list.nextElement();
- if (! (key instanceof Integer))
- continue;
- tmpKey = (Integer) key;
- element = table.get(tmpKey);
- // We won't paint them if they're not
- // JLabels so continue anyway
- if (! (element instanceof JLabel))
- continue;
- label = (Component) element;
- paintHorizontalLabel(g, tmpKey.intValue(), label);
- }
- }
- else
- {
- for (Enumeration list = table.keys(); list.hasMoreElements();)
- {
- key = list.nextElement();
- if (! (key instanceof Integer))
- continue;
- tmpKey = (Integer) key;
- element = table.get(tmpKey);
- // We won't paint them if they're not
- // JLabels so continue anyway
- if (! (element instanceof JLabel))
- continue;
- label = (Component) element;
- paintVerticalLabel(g, tmpKey.intValue(), label);
- }
- }
+ Dictionary table = slider.getLabelTable();
+ Integer tmpKey;
+ Object key;
+ Object element;
+ Component label;
+ if (slider.getOrientation() == JSlider.HORIZONTAL)
+ {
+ for (Enumeration list = table.keys(); list.hasMoreElements();)
+ {
+ key = list.nextElement();
+ if (! (key instanceof Integer))
+ continue;
+ tmpKey = (Integer) key;
+ element = table.get(tmpKey);
+ // We won't paint them if they're not
+ // JLabels so continue anyway
+ if (! (element instanceof JLabel))
+ continue;
+ label = (Component) element;
+ paintHorizontalLabel(g, tmpKey.intValue(), label);
+ }
+ }
+ else
+ {
+ for (Enumeration list = table.keys(); list.hasMoreElements();)
+ {
+ key = list.nextElement();
+ if (! (key instanceof Integer))
+ continue;
+ tmpKey = (Integer) key;
+ element = table.get(tmpKey);
+ // We won't paint them if they're not
+ // JLabels so continue anyway
+ if (! (element instanceof JLabel))
+ continue;
+ label = (Component) element;
+ paintVerticalLabel(g, tmpKey.intValue(), label);
+ }
+ }
}
}
@@ -1937,7 +1938,8 @@
h = labelRect.height;
label.setBounds(xpos, ypos, w, h);
- javax.swing.SwingUtilities.paintComponent(g, label, null,
label.getBounds());
+ javax.swing.SwingUtilities.paintComponent(g, label, null,
+ label.getBounds());
}
/**
@@ -1976,7 +1978,8 @@
w = labelRect.width;
label.setBounds(xpos, ypos, w, h);
- javax.swing.SwingUtilities.paintComponent(g, label, null,
label.getBounds());
+ javax.swing.SwingUtilities.paintComponent(g, label, null,
+ label.getBounds());
}
/**
@@ -2016,49 +2019,52 @@
Polygon dark; // dark shadow
Polygon all;
- // This will be in X-dimension if the slider is inverted and y if it
isn't.
+ // This will be in X-dimension if the slider is inverted and y if it
isn't.
int turnPoint;
if (slider.getOrientation() == JSlider.HORIZONTAL)
{
- turnPoint = thumbRect.height * 3 / 4;
+ turnPoint = thumbRect.height * 3 / 4;
- b.translate(thumbRect.width - 1, 0);
- c.translate(thumbRect.width - 1, turnPoint);
- d.translate(thumbRect.width / 2 - 1, thumbRect.height - 1);
- e.translate(0, turnPoint);
+ b.translate(thumbRect.width - 1, 0);
+ c.translate(thumbRect.width - 1, turnPoint);
+ d.translate(thumbRect.width / 2 - 1, thumbRect.height - 1);
+ e.translate(0, turnPoint);
- bright = new Polygon(new int[] { b.x - 1, a.x, e.x, d.x },
- new int[] { b.y, a.y, e.y, d.y }, 4);
+ bright = new Polygon(new int[] { b.x - 1, a.x, e.x, d.x },
+ new int[] { b.y, a.y, e.y, d.y }, 4);
- dark = new Polygon(new int[] { b.x, c.x, d.x + 1 },
- new int[] { b.y, c.y - 1, d.y }, 3);
+ dark = new Polygon(new int[] { b.x, c.x, d.x + 1 },
+ new int[] { b.y, c.y - 1, d.y }, 3);
light = new Polygon(new int[] { b.x - 1, c.x - 1, d.x + 1 },
new int[] { b.y + 1, c.y - 1, d.y - 1 }, 3);
- all = new Polygon(new int[] { a.x + 1, b.x - 2, c.x - 2, d.x, e.x + 1 },
- new int[] { a.y + 1, b.y + 1, c.y - 1, d.y - 1, e.y
}, 5);
+ all = new Polygon(new int[] { a.x + 1, b.x - 2, c.x - 2, d.x, e.x + 1
},
+ new int[] { a.y + 1, b.y + 1, c.y - 1, d.y - 1, e.y
},
+ 5);
}
else
{
- turnPoint = thumbRect.width * 3 / 4 - 1;
+ turnPoint = thumbRect.width * 3 / 4 - 1;
- b.translate(turnPoint, 0);
- c.translate(thumbRect.width - 1, thumbRect.height / 2);
- d.translate(turnPoint, thumbRect.height - 1);
- e.translate(0, thumbRect.height - 1);
+ b.translate(turnPoint, 0);
+ c.translate(thumbRect.width - 1, thumbRect.height / 2);
+ d.translate(turnPoint, thumbRect.height - 1);
+ e.translate(0, thumbRect.height - 1);
- bright = new Polygon(new int[] { c.x - 1, b.x, a.x, e.x },
- new int[] { c.y - 1, b.y, a.y, e.y - 1 }, 4);
+ bright = new Polygon(new int[] { c.x - 1, b.x, a.x, e.x },
+ new int[] { c.y - 1, b.y, a.y, e.y - 1 }, 4);
- dark = new Polygon(new int[] { c.x, d.x, e.x },
- new int[] { c.y, d.y, e.y }, 3);
+ dark = new Polygon(new int[] { c.x, d.x, e.x },
+ new int[] { c.y, d.y, e.y }, 3);
light = new Polygon(new int[] { c.x - 1, d.x, e.x + 1},
new int[] { c.y, d.y - 1, e.y - 1}, 3);
- all = new Polygon(new int[] { a.x + 1, b.x, c.x - 2, c.x - 2, d.x, e.x
+ 1 },
- new int[] { a.y + 1, b.y + 1, c.y - 1, c.y, d.y - 2,
e.y - 2 }, 6);
+ all = new Polygon(new int[] { a.x + 1, b.x, c.x - 2, c.x - 2, d.x,
+ e.x + 1 },
+ new int[] { a.y + 1, b.y + 1, c.y - 1, c.y, d.y - 2,
+ e.y - 2 }, 6);
}
g.setColor(Color.WHITE);
@@ -2163,8 +2169,8 @@
xPos += trackRect.x;
else
{
- xPos = len - xPos;
- xPos += trackRect.x;
+ xPos = len - xPos;
+ xPos += trackRect.x;
}
return xPos;
}
@@ -2186,8 +2192,8 @@
if (! drawInverted())
{
- yPos = len - yPos;
- yPos += trackRect.y;
+ yPos = len - yPos;
+ yPos += trackRect.y;
}
else
yPos += trackRect.y;
@@ -2298,26 +2304,26 @@
// First check the major ticks.
if (majorSpace > 0)
{
- int lowerBound = (value - min) / majorSpace;
- int majLower = majorSpace * lowerBound + min;
- int majHigher = majorSpace * (lowerBound + 1) + min;
-
- if (majHigher <= max && majHigher - value <= value - majLower)
- major = majHigher - value;
- else
- major = majLower - value;
+ int lowerBound = (value - min) / majorSpace;
+ int majLower = majorSpace * lowerBound + min;
+ int majHigher = majorSpace * (lowerBound + 1) + min;
+
+ if (majHigher <= max && majHigher - value <= value - majLower)
+ major = majHigher - value;
+ else
+ major = majLower - value;
}
if (minorSpace > 0)
{
- int lowerBound = value / minorSpace;
- int minLower = minorSpace * lowerBound;
- int minHigher = minorSpace * (lowerBound + 1);
-
- if (minHigher <= max && minHigher - value <= value - minLower)
- minor = minHigher - value;
- else
- minor = minLower - value;
+ int lowerBound = value / minorSpace;
+ int minLower = minorSpace * lowerBound;
+ int minHigher = minorSpace * (lowerBound + 1);
+
+ if (minHigher <= max && minHigher - value <= value - minLower)
+ minor = minHigher - value;
+ else
+ minor = minLower - value;
}
// Give preference to minor ticks