if (mouse.isMouse1()) {
// Selection.
+ int newLine = topLine + mouse.getY();
+ int newX = leftColumn + mouse.getX();
+
inSelection = true;
- selectionLine0 = topLine + mouse.getY();
+ if (newLine > document.getLineCount() - 1) {
+ selectionLine0 = document.getLineCount() - 1;
+ } else {
+ selectionLine0 = topLine + mouse.getY();
+ }
selectionColumn0 = leftColumn + mouse.getX();
selectionColumn0 = Math.max(0, Math.min(selectionColumn0,
document.getLine(selectionLine0).getDisplayLength() - 1));
selectionLine1 = selectionLine0;
// Set the row and column
- int newLine = topLine + mouse.getY();
- int newX = leftColumn + mouse.getX();
if (newLine > document.getLineCount() - 1) {
// Go to the end
document.setLineNumber(document.getLineCount() - 1);
final Throwable exception) {
super(application, i18n.getString("windowTitle"),
- 1, 1, 70, 20, CENTERED | MODAL);
+ 1, 1, 78, 22, CENTERED | MODAL);
this.exception = exception;
2, 6, "ttext", false);
ArrayList<String> stackTraceStrings = new ArrayList<String>();
+ stackTraceStrings.add(exception.getMessage());
StackTraceElement [] stack = exception.getStackTrace();
for (int i = 0; i < stack.length; i++) {
stackTraceStrings.add(stack[i].toString());
}
- stackTrace = addList(stackTraceStrings, 2, 7, getWidth() - 6, 8);
+ stackTrace = addList(stackTraceStrings, 2, 7, getWidth() - 6, 10);
// Buttons
- addButton(i18n.getString("saveButton"), 19, getHeight() - 4,
+ addButton(i18n.getString("saveButton"), 21, getHeight() - 4,
new TAction() {
public void DO() {
saveToFile();
});
TButton closeButton = addButton(i18n.getString("closeButton"),
- 35, getHeight() - 4,
+ 37, getHeight() - 4,
new TAction() {
public void DO() {
// Don't do anything, just close the window.
@Override
public void setWidth(final int width) {
super.setWidth(width);
- hScroller.setWidth(getWidth() - 1);
- vScroller.setX(getWidth() - 1);
+ if (hScroller != null) {
+ hScroller.setWidth(getWidth() - 1);
+ }
+ if (vScroller != null) {
+ 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);
+ if (hScroller != null) {
+ hScroller.setY(getHeight() - 1);
+ }
+ if (vScroller != null) {
+ vScroller.setHeight(getHeight() - 1);
+ }
}
/**
* @return difference between this.tabOrder and that.tabOrder, or
* difference between this.z and that.z, or String.compareTo(text)
*/
- public final int compareTo(final TWidget that) {
+ public int compareTo(final TWidget that) {
if ((this instanceof TWindow)
&& (that instanceof TWindow)
) {
if (activeChild != null) {
activeChild.active = false;
}
- child.active = true;
- activeChild = child;
}
+ child.active = true;
+ activeChild = child;
}
}
// 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);
+ if (hScroller != null) {
+ hScroller.setWidth(getWidth() - 1);
+ }
+ if (vScroller != null) {
+ vScroller.setX(getWidth() - 1);
+ }
+ if (treeView != null) {
+ treeView.setWidth(getWidth() - 1);
+ }
+ reflowData();
+ }
+
+ /**
+ * Override TWidget's height: we need to set child widget heights.
+ *
+ * @param height new widget height
+ */
+ @Override
+ public void setHeight(final int height) {
+ super.setHeight(height);
+ if (hScroller != null) {
+ hScroller.setY(getHeight() - 1);
+ }
+ if (vScroller != null) {
+ vScroller.setHeight(getHeight() - 1);
+ }
+ if (treeView != null) {
+ treeView.setHeight(getHeight() - 1);
+ }
+ reflowData();
+ }
+
/**
* Resize text and scrollbars for a new width/height.
*/
@Override
public void reflowData() {
+ if (treeView == null) {
+ return;
+ }
+
int selectedRow = 0;
boolean foundSelectedRow = false;