470 |
} |
} |
471 |
} |
} |
472 |
|
|
|
/** The preferred height of the thumb. */ |
|
|
private transient int thumbHeight; |
|
|
|
|
|
/** The preferred width of the thumb. */ |
|
|
private transient int thumbWidth; |
|
|
|
|
|
/** The preferred height of the tick rectangle. */ |
|
|
private transient int tickHeight; |
|
|
|
|
473 |
/** Listener for changes from the model. */ |
/** Listener for changes from the model. */ |
474 |
protected ChangeListener changeListener; |
protected ChangeListener changeListener; |
475 |
|
|
689 |
focusColor = defaults.getColor("Slider.focus"); |
focusColor = defaults.getColor("Slider.focus"); |
690 |
slider.setBorder(defaults.getBorder("Slider.border")); |
slider.setBorder(defaults.getBorder("Slider.border")); |
691 |
slider.setOpaque(true); |
slider.setOpaque(true); |
|
|
|
|
thumbHeight = defaults.getInt("Slider.thumbHeight"); |
|
|
thumbWidth = defaults.getInt("Slider.thumbWidth"); |
|
|
tickHeight = defaults.getInt("Slider.tickHeight"); |
|
|
|
|
692 |
focusInsets = defaults.getInsets("Slider.focusInsets"); |
focusInsets = defaults.getInsets("Slider.focusInsets"); |
693 |
} |
} |
694 |
|
|
885 |
width += insets.left + insets.right + focusInsets.left + focusInsets.right; |
width += insets.left + insets.right + focusInsets.left + focusInsets.right; |
886 |
|
|
887 |
// Height is determined by the thumb, the ticks and the labels. |
// Height is determined by the thumb, the ticks and the labels. |
888 |
int height = thumbHeight; |
int height = getThumbSize().height; |
889 |
|
|
890 |
if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0 |
if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0 |
891 |
|| slider.getMinorTickSpacing() > 0) |
|| slider.getMinorTickSpacing() > 0) |
892 |
height += tickHeight; |
height += getTickLength(); |
893 |
|
|
894 |
if (slider.getPaintLabels()) |
if (slider.getPaintLabels()) |
895 |
height += getHeightOfTallestLabel(); |
height += getHeightOfTallestLabel(); |
920 |
height += insets.top + insets.bottom + focusInsets.top |
height += insets.top + insets.bottom + focusInsets.top |
921 |
+ focusInsets.bottom; |
+ focusInsets.bottom; |
922 |
|
|
923 |
int width = thumbHeight; |
int width = getThumbSize().width; |
924 |
|
|
925 |
if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0 |
if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0 |
926 |
|| slider.getMinorTickSpacing() > 0) |
|| slider.getMinorTickSpacing() > 0) |
927 |
width += tickHeight; |
width += getTickLength(); |
928 |
|
|
929 |
if (slider.getPaintLabels()) |
if (slider.getPaintLabels()) |
930 |
width += getWidthOfWidestLabel(); |
width += getWidthOfWidestLabel(); |
942 |
*/ |
*/ |
943 |
public Dimension getMinimumHorizontalSize() |
public Dimension getMinimumHorizontalSize() |
944 |
{ |
{ |
945 |
return getPreferredHorizontalSize(); |
Insets insets = slider.getInsets(); |
946 |
|
// Height is determined by the thumb, the ticks and the labels. |
947 |
|
int height = getThumbSize().height; |
948 |
|
|
949 |
|
if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0 |
950 |
|
|| slider.getMinorTickSpacing() > 0) |
951 |
|
height += getTickLength(); |
952 |
|
|
953 |
|
if (slider.getPaintLabels()) |
954 |
|
height += getHeightOfTallestLabel(); |
955 |
|
|
956 |
|
height += insets.top + insets.bottom + focusInsets.top |
957 |
|
+ focusInsets.bottom; |
958 |
|
|
959 |
|
return new Dimension(36, height); |
960 |
} |
} |
961 |
|
|
962 |
/** |
/** |
967 |
*/ |
*/ |
968 |
public Dimension getMinimumVerticalSize() |
public Dimension getMinimumVerticalSize() |
969 |
{ |
{ |
970 |
return getPreferredVerticalSize(); |
Insets insets = slider.getInsets(); |
971 |
|
int width = getThumbSize().width; |
972 |
|
|
973 |
|
if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0 |
974 |
|
|| slider.getMinorTickSpacing() > 0) |
975 |
|
width += getTickLength(); |
976 |
|
|
977 |
|
if (slider.getPaintLabels()) |
978 |
|
width += getWidthOfWidestLabel(); |
979 |
|
|
980 |
|
width += insets.left + insets.right + focusInsets.left + focusInsets.right; |
981 |
|
|
982 |
|
return new Dimension(width, 36); |
983 |
} |
} |
984 |
|
|
985 |
/** |
/** |
1011 |
public Dimension getMinimumSize(JComponent c) |
public Dimension getMinimumSize(JComponent c) |
1012 |
{ |
{ |
1013 |
if (slider.getOrientation() == JSlider.HORIZONTAL) |
if (slider.getOrientation() == JSlider.HORIZONTAL) |
1014 |
return getPreferredHorizontalSize(); |
return getMinimumHorizontalSize(); |
1015 |
else |
else |
1016 |
return getPreferredVerticalSize(); |
return getMinimumVerticalSize(); |
1017 |
} |
} |
1018 |
|
|
1019 |
/** |
/** |
1020 |
* This method returns the maximum size for this {@link JSlider} for this |
* This method returns the maximum size for this {@link JSlider} for this |
1021 |
* look and feel. If it returns null, then it is up to the Layout Manager |
* look and feel. |
|
* to give the {@link JComponent} a size. |
|
1022 |
* |
* |
1023 |
* @param c The {@link JComponent} to find a maximum size for. |
* @param c The {@link JComponent} to find a maximum size for. |
1024 |
* |
* |
1026 |
*/ |
*/ |
1027 |
public Dimension getMaximumSize(JComponent c) |
public Dimension getMaximumSize(JComponent c) |
1028 |
{ |
{ |
1029 |
|
Insets insets = slider.getInsets(); |
1030 |
if (slider.getOrientation() == JSlider.HORIZONTAL) |
if (slider.getOrientation() == JSlider.HORIZONTAL) |
1031 |
return getPreferredHorizontalSize(); |
{ |
1032 |
|
// Height is determined by the thumb, the ticks and the labels. |
1033 |
|
int height = getThumbSize().height; |
1034 |
|
|
1035 |
|
if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0 |
1036 |
|
|| slider.getMinorTickSpacing() > 0) |
1037 |
|
height += getTickLength(); |
1038 |
|
|
1039 |
|
if (slider.getPaintLabels()) |
1040 |
|
height += getHeightOfTallestLabel(); |
1041 |
|
|
1042 |
|
height += insets.top + insets.bottom + focusInsets.top |
1043 |
|
+ focusInsets.bottom; |
1044 |
|
|
1045 |
|
return new Dimension(32767, height); |
1046 |
|
} |
1047 |
else |
else |
1048 |
return getPreferredVerticalSize(); |
{ |
1049 |
|
int width = getThumbSize().width; |
1050 |
|
|
1051 |
|
if (slider.getPaintTicks() && slider.getMajorTickSpacing() > 0 |
1052 |
|
|| slider.getMinorTickSpacing() > 0) |
1053 |
|
width += getTickLength(); |
1054 |
|
|
1055 |
|
if (slider.getPaintLabels()) |
1056 |
|
width += getWidthOfWidestLabel(); |
1057 |
|
|
1058 |
|
width += insets.left + insets.right + focusInsets.left |
1059 |
|
+ focusInsets.right; |
1060 |
|
|
1061 |
|
return new Dimension(width, 32767); |
1062 |
|
} |
1063 |
} |
} |
1064 |
|
|
1065 |
/** |
/** |
1086 |
{ |
{ |
1087 |
insetCache = slider.getInsets(); |
insetCache = slider.getInsets(); |
1088 |
focusRect = SwingUtilities.calculateInnerArea(slider, focusRect); |
focusRect = SwingUtilities.calculateInnerArea(slider, focusRect); |
|
|
|
1089 |
if (focusRect.width < 0) |
if (focusRect.width < 0) |
1090 |
focusRect.width = 0; |
focusRect.width = 0; |
1091 |
if (focusRect.height < 0) |
if (focusRect.height < 0) |
1098 |
*/ |
*/ |
1099 |
protected void calculateThumbSize() |
protected void calculateThumbSize() |
1100 |
{ |
{ |
1101 |
|
Dimension d = getThumbSize(); |
1102 |
|
thumbRect.width = d.width; |
1103 |
|
thumbRect.height = d.height; |
1104 |
if (slider.getOrientation() == JSlider.HORIZONTAL) |
if (slider.getOrientation() == JSlider.HORIZONTAL) |
1105 |
{ |
thumbRect.y = trackRect.y; |
|
if (thumbWidth > contentRect.width) |
|
|
thumbRect.width = contentRect.width / 4; |
|
|
else |
|
|
thumbRect.width = thumbWidth; |
|
|
if (thumbHeight > contentRect.height) |
|
|
thumbRect.height = contentRect.height; |
|
|
else |
|
|
thumbRect.height = thumbHeight; |
|
|
} |
|
1106 |
else |
else |
1107 |
{ |
thumbRect.x = trackRect.x; |
|
// The thumb gets flipped when inverted, so thumbWidth |
|
|
// actually is the height and vice versa. |
|
|
if (thumbWidth > contentRect.height) |
|
|
thumbRect.height = contentRect.height / 4; |
|
|
else |
|
|
thumbRect.height = thumbWidth; |
|
|
if (thumbHeight > contentRect.width) |
|
|
thumbRect.width = contentRect.width; |
|
|
else |
|
|
thumbRect.width = thumbHeight; |
|
|
} |
|
1108 |
} |
} |
1109 |
|
|
1110 |
/** |
/** |
1115 |
{ |
{ |
1116 |
contentRect.x = focusRect.x + focusInsets.left; |
contentRect.x = focusRect.x + focusInsets.left; |
1117 |
contentRect.y = focusRect.y + focusInsets.top; |
contentRect.y = focusRect.y + focusInsets.top; |
1118 |
|
|
1119 |
contentRect.width = focusRect.width - focusInsets.left - focusInsets.right; |
contentRect.width = focusRect.width - focusInsets.left - focusInsets.right; |
1120 |
contentRect.height = focusRect.height - focusInsets.top |
contentRect.height = focusRect.height - focusInsets.top |
1121 |
- focusInsets.bottom; |
- focusInsets.bottom; |
1122 |
|
|
1123 |
if (contentRect.width < 0) |
if (contentRect.width < 0) |
1124 |
contentRect.width = 0; |
contentRect.width = 0; |
1137 |
if (slider.getOrientation() == JSlider.HORIZONTAL) |
if (slider.getOrientation() == JSlider.HORIZONTAL) |
1138 |
{ |
{ |
1139 |
thumbRect.x = xPositionForValue(value) - thumbRect.width / 2; |
thumbRect.x = xPositionForValue(value) - thumbRect.width / 2; |
1140 |
thumbRect.y = contentRect.y; |
thumbRect.y = trackRect.y; |
1141 |
} |
} |
1142 |
else |
else |
1143 |
{ |
{ |
1144 |
thumbRect.x = contentRect.x; |
thumbRect.x = trackRect.x; |
1145 |
thumbRect.y = yPositionForValue(value) - thumbRect.height / 2; |
thumbRect.y = yPositionForValue(value) - thumbRect.height / 2; |
1146 |
} |
} |
1147 |
} |
} |
1153 |
protected void calculateTrackBuffer() |
protected void calculateTrackBuffer() |
1154 |
{ |
{ |
1155 |
if (slider.getOrientation() == JSlider.HORIZONTAL) |
if (slider.getOrientation() == JSlider.HORIZONTAL) |
1156 |
trackBuffer = thumbRect.width; |
trackBuffer = thumbRect.width / 2; |
1157 |
else |
else |
1158 |
trackBuffer = thumbRect.height; |
trackBuffer = thumbRect.height / 2; |
1159 |
} |
} |
1160 |
|
|
1161 |
/** |
/** |
1165 |
*/ |
*/ |
1166 |
protected Dimension getThumbSize() |
protected Dimension getThumbSize() |
1167 |
{ |
{ |
1168 |
// This is really just the bounds box for the thumb. |
// TODO: shouldn't create new objects every time |
1169 |
// The thumb will actually be pointed (like a rectangle + triangle at bottom) |
if (slider.getOrientation() == JSlider.HORIZONTAL) |
1170 |
return thumbRect.getSize(); |
return new Dimension(11, 20); |
1171 |
|
else |
1172 |
|
return new Dimension(20, 11); |
1173 |
} |
} |
1174 |
|
|
1175 |
/** |
/** |
1181 |
if (slider.getOrientation() == JSlider.HORIZONTAL) |
if (slider.getOrientation() == JSlider.HORIZONTAL) |
1182 |
{ |
{ |
1183 |
trackRect.x = contentRect.x + trackBuffer; |
trackRect.x = contentRect.x + trackBuffer; |
1184 |
trackRect.y = contentRect.y; |
int h = getThumbSize().height; |
1185 |
|
if (slider.getPaintTicks() && (slider.getMajorTickSpacing() > 0 |
1186 |
|
|| slider.getMinorTickSpacing() > 0)) |
1187 |
|
h += getTickLength(); |
1188 |
|
trackRect.y = contentRect.y + (contentRect.height - h) / 2 - 1; |
1189 |
trackRect.width = contentRect.width - 2 * trackBuffer; |
trackRect.width = contentRect.width - 2 * trackBuffer; |
1190 |
trackRect.height = thumbRect.height; |
trackRect.height = thumbRect.height; |
1191 |
} |
} |
1192 |
else |
else |
1193 |
{ |
{ |
1194 |
trackRect.x = contentRect.x; |
int w = getThumbSize().width; |
1195 |
|
if (slider.getPaintTicks() && (slider.getMajorTickSpacing() > 0 |
1196 |
|
|| slider.getMinorTickSpacing() > 0)) |
1197 |
|
w += getTickLength(); |
1198 |
|
trackRect.x = contentRect.x + (contentRect.width - w) / 2 - 1; |
1199 |
trackRect.y = contentRect.y + trackBuffer; |
trackRect.y = contentRect.y + trackBuffer; |
1200 |
trackRect.width = thumbRect.width; |
trackRect.width = thumbRect.width; |
1201 |
trackRect.height = contentRect.height - 2 * trackBuffer; |
trackRect.height = contentRect.height - 2 * trackBuffer; |
1214 |
*/ |
*/ |
1215 |
protected int getTickLength() |
protected int getTickLength() |
1216 |
{ |
{ |
1217 |
return tickHeight; |
return 8; |
1218 |
} |
} |
1219 |
|
|
1220 |
/** |
/** |
1570 |
Point c = new Point(a); |
Point c = new Point(a); |
1571 |
Point d = new Point(a); |
Point d = new Point(a); |
1572 |
|
|
|
Polygon high; |
|
|
Polygon shadow; |
|
|
|
|
1573 |
if (slider.getOrientation() == JSlider.HORIZONTAL) |
if (slider.getOrientation() == JSlider.HORIZONTAL) |
1574 |
{ |
{ |
1575 |
width = trackRect.width; |
width = trackRect.width; |
1622 |
{ |
{ |
1623 |
if (slider.getOrientation() == JSlider.HORIZONTAL) |
if (slider.getOrientation() == JSlider.HORIZONTAL) |
1624 |
{ |
{ |
1625 |
double loc = tickRect.x; |
double loc = tickRect.x + 0.5; |
1626 |
double increment = (max == min) ? 0 |
double increment = (max == min) ? 0 |
1627 |
: majorSpace * (double) tickRect.width / (max |
: majorSpace * (double) (tickRect.width - 1) / (max - min); |
1628 |
- min); |
if (drawInverted()) |
|
if (drawInverted()) |
|
1629 |
{ |
{ |
1630 |
loc += tickRect.width; |
loc += tickRect.width; |
1631 |
increment *= -1; |
increment *= -1; |
1632 |
} |
} |
1633 |
|
g.translate(0, tickRect.y); |
1634 |
for (int i = min; i <= max; i += majorSpace) |
for (int i = min; i <= max; i += majorSpace) |
1635 |
{ |
{ |
1636 |
paintMajorTickForHorizSlider(g, tickRect, (int) loc); |
paintMajorTickForHorizSlider(g, tickRect, (int) loc); |
1637 |
loc += increment; |
loc += increment; |
1638 |
} |
} |
1639 |
|
g.translate(0, -tickRect.y); |
1640 |
} |
} |
1641 |
else |
else |
1642 |
{ |
{ |
1643 |
double loc = tickRect.height + tickRect.y; |
double loc = tickRect.height + tickRect.y + 0.5; |
1644 |
double increment = (max == min) ? 0 |
double increment = (max == min) ? 0 |
1645 |
: -majorSpace * (double) tickRect.height / (max |
: -majorSpace * (double) (tickRect.height - 1) / (max - min); |
|
- min); |
|
1646 |
if (drawInverted()) |
if (drawInverted()) |
1647 |
{ |
{ |
1648 |
loc = tickRect.y; |
loc = tickRect.y + 0.5; |
1649 |
increment *= -1; |
increment *= -1; |
1650 |
} |
} |
1651 |
|
g.translate(tickRect.x, 0); |
1652 |
for (int i = min; i <= max; i += majorSpace) |
for (int i = min; i <= max; i += majorSpace) |
1653 |
{ |
{ |
1654 |
paintMajorTickForVertSlider(g, tickRect, (int) loc); |
paintMajorTickForVertSlider(g, tickRect, (int) loc); |
1655 |
loc += increment; |
loc += increment; |
1656 |
} |
} |
1657 |
|
g.translate(-tickRect.x, 0); |
1658 |
} |
} |
1659 |
} |
} |
1660 |
if (minorSpace > 0) |
if (minorSpace > 0) |
1661 |
{ |
{ |
1662 |
if (slider.getOrientation() == JSlider.HORIZONTAL) |
if (slider.getOrientation() == JSlider.HORIZONTAL) |
1663 |
{ |
{ |
1664 |
double loc = tickRect.x; |
double loc = tickRect.x + 0.5; |
1665 |
double increment = (max == min) ? 0 |
double increment = (max == min) ? 0 |
1666 |
: minorSpace * (double) tickRect.width / (max |
: minorSpace * (double) (tickRect.width - 1) / (max - min); |
|
- min); |
|
1667 |
if (drawInverted()) |
if (drawInverted()) |
1668 |
{ |
{ |
1669 |
loc += tickRect.width; |
loc += tickRect.width; |
1670 |
increment *= -1; |
increment *= -1; |
1671 |
} |
} |
1672 |
|
g.translate(0, tickRect.y); |
1673 |
for (int i = min; i <= max; i += minorSpace) |
for (int i = min; i <= max; i += minorSpace) |
1674 |
{ |
{ |
1675 |
paintMinorTickForHorizSlider(g, tickRect, (int) loc); |
paintMinorTickForHorizSlider(g, tickRect, (int) loc); |
1676 |
loc += increment; |
loc += increment; |
1677 |
} |
} |
1678 |
|
g.translate(0, -tickRect.y); |
1679 |
} |
} |
1680 |
else |
else |
1681 |
{ |
{ |
1682 |
double loc = tickRect.height + tickRect.y; |
double loc = tickRect.height + tickRect.y + 0.5; |
1683 |
double increment = (max == min) ? 0 |
double increment = (max == min) ? 0 |
1684 |
: -minorSpace * (double) tickRect.height / (max |
: -minorSpace * (double) (tickRect.height - 1) / (max - min); |
|
- min); |
|
1685 |
if (drawInverted()) |
if (drawInverted()) |
1686 |
{ |
{ |
1687 |
loc = tickRect.y; |
loc = tickRect.y + 0.5; |
1688 |
increment *= -1; |
increment *= -1; |
1689 |
} |
} |
1690 |
|
g.translate(tickRect.x, 0); |
1691 |
for (int i = min; i <= max; i += minorSpace) |
for (int i = min; i <= max; i += minorSpace) |
1692 |
{ |
{ |
1693 |
paintMinorTickForVertSlider(g, tickRect, (int) loc); |
paintMinorTickForVertSlider(g, tickRect, (int) loc); |
1694 |
loc += increment; |
loc += increment; |
1695 |
} |
} |
1696 |
|
g.translate(-tickRect.x, 0); |
1697 |
} |
} |
1698 |
} |
} |
1699 |
} |
} |
1715 |
protected void paintMinorTickForHorizSlider(Graphics g, |
protected void paintMinorTickForHorizSlider(Graphics g, |
1716 |
Rectangle tickBounds, int x) |
Rectangle tickBounds, int x) |
1717 |
{ |
{ |
1718 |
int y = tickRect.y + tickRect.height / 4; |
int y = tickRect.height / 4; |
1719 |
Color saved = g.getColor(); |
Color saved = g.getColor(); |
1720 |
g.setColor(Color.BLACK); |
g.setColor(Color.BLACK); |
1721 |
|
|
1734 |
protected void paintMajorTickForHorizSlider(Graphics g, |
protected void paintMajorTickForHorizSlider(Graphics g, |
1735 |
Rectangle tickBounds, int x) |
Rectangle tickBounds, int x) |
1736 |
{ |
{ |
1737 |
int y = tickRect.y + tickRect.height / 4; |
int y = tickRect.height / 4; |
1738 |
Color saved = g.getColor(); |
Color saved = g.getColor(); |
1739 |
g.setColor(Color.BLACK); |
g.setColor(Color.BLACK); |
1740 |
|
|
1753 |
protected void paintMinorTickForVertSlider(Graphics g, Rectangle tickBounds, |
protected void paintMinorTickForVertSlider(Graphics g, Rectangle tickBounds, |
1754 |
int y) |
int y) |
1755 |
{ |
{ |
1756 |
int x = tickRect.x + tickRect.width / 4; |
int x = tickRect.width / 4; |
1757 |
Color saved = g.getColor(); |
Color saved = g.getColor(); |
1758 |
g.setColor(Color.BLACK); |
g.setColor(Color.BLACK); |
1759 |
|
|
1772 |
protected void paintMajorTickForVertSlider(Graphics g, Rectangle tickBounds, |
protected void paintMajorTickForVertSlider(Graphics g, Rectangle tickBounds, |
1773 |
int y) |
int y) |
1774 |
{ |
{ |
1775 |
int x = tickRect.x + tickRect.width / 4; |
int x = tickRect.width / 4; |
1776 |
Color saved = g.getColor(); |
Color saved = g.getColor(); |
1777 |
g.setColor(Color.BLACK); |
g.setColor(Color.BLACK); |
1778 |
|
|
2109 |
{ |
{ |
2110 |
int min = slider.getMinimum(); |
int min = slider.getMinimum(); |
2111 |
int max = slider.getMaximum(); |
int max = slider.getMaximum(); |
2112 |
int extent = slider.getExtent(); |
int len = trackRect.width - 1; |
|
int len = trackRect.width; |
|
2113 |
|
|
2114 |
int xPos = (max == min) ? 0 : (value - min) * len / (max - min); |
int xPos = (max == min) ? 0 : (value - min) * len / (max - min); |
2115 |
|
|
2117 |
xPos += trackRect.x; |
xPos += trackRect.x; |
2118 |
else |
else |
2119 |
{ |
{ |
2120 |
xPos = trackRect.width - xPos; |
xPos = len - xPos; |
2121 |
xPos += trackRect.x; |
xPos += trackRect.x; |
2122 |
} |
} |
2123 |
return xPos; |
return xPos; |
2134 |
{ |
{ |
2135 |
int min = slider.getMinimum(); |
int min = slider.getMinimum(); |
2136 |
int max = slider.getMaximum(); |
int max = slider.getMaximum(); |
2137 |
int extent = slider.getExtent(); |
int len = trackRect.height - 1; |
|
int len = trackRect.height; |
|
2138 |
|
|
2139 |
int yPos = (max == min) ? 0 : (value - min) * len / (max - min); |
int yPos = (max == min) ? 0 : (value - min) * len / (max - min); |
2140 |
|
|
2141 |
if (! drawInverted()) |
if (! drawInverted()) |
2142 |
{ |
{ |
2143 |
yPos = trackRect.height - yPos; |
yPos = len - yPos; |
2144 |
yPos += trackRect.y; |
yPos += trackRect.y; |
2145 |
} |
} |
2146 |
else |
else |
2165 |
|
|
2166 |
int value; |
int value; |
2167 |
|
|
2168 |
// If the length is 0, you shouldn't be able to even see where the slider is. |
// If the length is 0, you shouldn't be able to even see where the slider |
2169 |
// This really shouldn't ever happen, but just in case, we'll return the middle. |
// is. This really shouldn't ever happen, but just in case, we'll return |
2170 |
|
// the middle. |
2171 |
if (len == 0) |
if (len == 0) |
2172 |
return ((max - min) / 2); |
return ((max - min) / 2); |
2173 |
|
|
2201 |
|
|
2202 |
int value; |
int value; |
2203 |
|
|
2204 |
// If the length is 0, you shouldn't be able to even see where the slider is. |
// If the length is 0, you shouldn't be able to even see where the slider |
2205 |
// This really shouldn't ever happen, but just in case, we'll return the middle. |
// is. This really shouldn't ever happen, but just in case, we'll return |
2206 |
|
// the middle. |
2207 |
if (len == 0) |
if (len == 0) |
2208 |
return ((max - min) / 2); |
return ((max - min) / 2); |
2209 |
|
|