- dead local store in getPreferredWidth()
if (height != -1) {
height = Math.max(height - (padding.top + padding.bottom
+ 2), 0);
}
but height inside this method is not used, is a mistake ? mhhh seems
yes, because this method is for the width ...
Fixed.
- int division result cast to double or float in paint() :
// original:
// graphics.setPaint(new GradientPaint(width / 2, 0,
bevelColor,
// width / 2, height / 2, backgroundColor));
// new:
graphics.setPaint(new GradientPaint((float) width / 2, 0,
bevelColor,
(float) width / 2, (float) height / 2,
backgroundColor));
This is OK.
- int value cast to float and then passed to Math.round in paint()
// int tx = triggerBounds.x + Math.round((triggerBounds.width -
triggerIconShape.getBounds().width) / 2);
int tx = triggerBounds.x + ((triggerBounds.width -
triggerIconShape.getBounds().width) / 2);
and the same also for the line with ty ...
Removed the call to Math.round().