import java.util.List;
import jexer.bits.CellAttributes;
+import jexer.bits.StringUtils;
import jexer.event.TKeypressEvent;
import jexer.event.TMouseEvent;
import static jexer.TKeypress.*;
// TScrollableWidget ------------------------------------------------------
// ------------------------------------------------------------------------
+ /**
+ * Override TWidget's width: we need to set child widget widths.
+ *
+ * @param width new widget width
+ */
+ @Override
+ public void setWidth(final int width) {
+ super.setWidth(width);
+ hScroller.setWidth(getWidth() - 1);
+ vScroller.setX(getWidth() - 1);
+ }
+
+ /**
+ * Override TWidget's height: we need to set child widget heights.
+ * time.
+ *
+ * @param height new widget height
+ */
+ @Override
+ public void setHeight(final int height) {
+ super.setHeight(height);
+ hScroller.setY(getHeight() - 1);
+ vScroller.setHeight(getHeight() - 1);
+ }
+
/**
* Resize for a new width/height.
*/
for (int i = 0; i < strings.size(); i++) {
String line = strings.get(i);
- if (line.length() > maxLineWidth) {
- maxLineWidth = line.length();
+ int lineLength = StringUtils.width(line);
+ if (lineLength > maxLineWidth) {
+ maxLineWidth = lineLength;
}
}
assert (selectedString >= 0);
assert (selectedString < strings.size());
if (enterAction != null) {
- enterAction.DO();
+ enterAction.DO(this);
}
}
assert (selectedString >= 0);
assert (selectedString < strings.size());
if (moveAction != null) {
- moveAction.DO();
+ moveAction.DO(this);
}
}
assert (selectedString >= 0);
assert (selectedString < strings.size());
if (singleClickAction != null) {
- singleClickAction.DO();
+ singleClickAction.DO(this);
}
}