#7 fix whitespace
[nikiroo-utils.git] / src / jexer / TWidget.java
index 4dfe5a14a890e3b4415232ab75d2d035ab20ded3..4450e52fbe97c094bbbf554021536024f878903f 100644 (file)
@@ -3,7 +3,7 @@
  *
  * The MIT License (MIT)
  *
- * Copyright (C) 2016 Kevin Lamonte
+ * Copyright (C) 2017 Kevin Lamonte
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -868,7 +868,8 @@ public abstract class TWidget implements Comparable<TWidget> {
      */
     public void onMouseDown(final TMouseEvent mouse) {
         // Default: do nothing, pass to children instead
-        for (TWidget widget: children) {
+        for (int i = children.size() - 1 ; i >= 0 ; i--) {
+            TWidget widget = children.get(i);
             if (widget.mouseWouldHit(mouse)) {
                 // Dispatch to this child, also activate it
                 activate(widget);
@@ -889,7 +890,8 @@ public abstract class TWidget implements Comparable<TWidget> {
      */
     public void onMouseUp(final TMouseEvent mouse) {
         // Default: do nothing, pass to children instead
-        for (TWidget widget: children) {
+        for (int i = children.size() - 1 ; i >= 0 ; i--) {
+            TWidget widget = children.get(i);
             if (widget.mouseWouldHit(mouse)) {
                 // Dispatch to this child, also activate it
                 activate(widget);