-/**
+/*
* Jexer - Java Text User Interface
*
* License: LGPLv3 or later
* @param parent parent widget
* @param x column relative to parent
* @param y row relative to parent
- * @param width height of scroll bar
+ * @param height height of scroll bar
*/
public TVScroller(final TWidget parent, final int x, final int y,
final int height) {
// Set parent and window
- super(parent);
-
- setX(x);
- setY(y);
- setHeight(height);
- setWidth(1);
+ super(parent, x, y, 1, height);
}
/**
* Compute the position of the scroll box (a.k.a. grip, thumb).
*
- * @param Y position of the box, between 1 and height - 2
+ * @return Y position of the box, between 1 and height - 2
*/
private int boxPosition() {
return (getHeight() - 3) * (value - topValue) / (bottomValue - topValue) + 1;
return;
}
- if ((mouse.getMouse1()) &&
- (inScroll) &&
- (mouse.getY() > 0) &&
- (mouse.getY() < getHeight() - 1)
+ if ((mouse.isMouse1())
+ && (inScroll)
+ && (mouse.getY() > 0)
+ && (mouse.getY() < getHeight() - 1)
) {
// Recompute value based on new box position
- value = (bottomValue - topValue) * (mouse.getY()) / (getHeight() - 3) + topValue;
+ value = (bottomValue - topValue)
+ * (mouse.getY()) / (getHeight() - 3) + topValue;
return;
}