}
secondaryEventReceiver.handleEvent(event);
- if (doubleClick != null) {
- secondaryEventReceiver.handleEvent(doubleClick);
+ // Note that it is possible for secondaryEventReceiver to be null
+ // now, because its handleEvent() might have finished out on the
+ // secondary thread. So put any extra processing inside a null
+ // check.
+ if (secondaryEventReceiver != null) {
+ if (doubleClick != null) {
+ secondaryEventReceiver.handleEvent(doubleClick);
+ }
}
}
keepTimers.add(timer);
}
}
- timers = keepTimers;
+ timers.clear();
+ timers.addAll(keepTimers);
}
// Call onIdle's
System.currentTimeMillis(), Thread.currentThread(), x, y);
}
CellAttributes attr = getScreen().getAttrXY(x, y);
- attr.setForeColor(attr.getForeColor().invert());
- attr.setBackColor(attr.getBackColor().invert());
+ if (attr.getForeColorRGB() < 0) {
+ attr.setForeColor(attr.getForeColor().invert());
+ } else {
+ attr.setForeColorRGB(attr.getForeColorRGB() ^ 0x00ffffff);
+ }
+ if (attr.getBackColorRGB() < 0) {
+ attr.setBackColor(attr.getBackColor().invert());
+ } else {
+ attr.setBackColorRGB(attr.getBackColorRGB() ^ 0x00ffffff);
+ }
getScreen().putAttrXY(x, y, attr, false);
}
}
/**
- * Add a window to my window list and make it active.
+ * Add a window to my window list and make it active. Note package
+ * private access.
*
* @param window new window to add
*/
- public final void addWindowToApplication(final TWindow window) {
+ final void addWindowToApplication(final TWindow window) {
// Do not add menu windows to the window list.
if (window instanceof TMenu) {
}
synchronized (windows) {
+ if (windows.contains(window)) {
+ throw new IllegalArgumentException("Window " + window +
+ " is already in window list");
+ }
+
// Whatever window might be moving/dragging, stop it now.
for (TWindow w: windows) {
if (w.inMovements()) {
* @param title window title, will be centered along the top border
* @param width width of window
* @param height height of window
+ * @return the new window
*/
public final TWindow addWindow(final String title, final int width,
final int height) {
* @param width width of window
* @param height height of window
* @param flags bitmask of RESIZABLE, CENTERED, or MODAL
+ * @return the new window
*/
public final TWindow addWindow(final String title,
final int width, final int height, final int flags) {
* @param y row relative to parent
* @param width width of window
* @param height height of window
+ * @return the new window
*/
public final TWindow addWindow(final String title,
final int x, final int y, final int width, final int height) {
* @param width width of window
* @param height height of window
* @param flags mask of RESIZABLE, CENTERED, or MODAL
+ * @return the new window
*/
public final TWindow addWindow(final String title,
final int x, final int y, final int width, final int height,
* active.
*
* @param file the file to open
+ * @return the new editor window
* @throws IOException if a java.io operation throws
*/
public final TEditorWindow addEditor(final File file) throws IOException {