Merge branch 'subtree'
[fanfix.git] / src / jexer / TSpinner.java
index cdc5c0f4ed9b5bee9d9dda45e708e0cd471c56f8..61fac65983ab4ddb9b106f14710747c00795ec62 100644 (file)
@@ -3,7 +3,7 @@
  *
  * The MIT License (MIT)
  *
- * Copyright (C) 2017 Kevin Lamonte
+ * Copyright (C) 2019 Kevin Lamonte
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -35,7 +35,7 @@ import jexer.event.TMouseEvent;
 import static jexer.TKeypress.*;
 
 /**
- * TSpinner implements a simple up/down spinner.  Values can be numer
+ * TSpinner implements a simple up/down spinner.
  */
 public class TSpinner extends TWidget {
 
@@ -89,7 +89,7 @@ public class TSpinner extends TWidget {
      */
     private boolean mouseOnUpArrow(final TMouseEvent mouse) {
         if ((mouse.getY() == 0)
-            && (mouse.getX() == getWidth() - 1)
+            && (mouse.getX() == getWidth() - 2)
         ) {
             return true;
         }
@@ -104,7 +104,7 @@ public class TSpinner extends TWidget {
      */
     private boolean mouseOnDownArrow(final TMouseEvent mouse) {
         if ((mouse.getY() == 0)
-            && (mouse.getX() == getWidth() - 2)
+            && (mouse.getX() == getWidth() - 1)
         ) {
             return true;
         }
@@ -162,10 +162,8 @@ public class TSpinner extends TWidget {
             spinnerColor = getTheme().getColor("tspinner.inactive");
         }
 
-        getScreen().putCharXY(getWidth() - 2, 0, GraphicsChars.UPARROW,
-            spinnerColor);
-        getScreen().putCharXY(getWidth() - 1, 0, GraphicsChars.DOWNARROW,
-            spinnerColor);
+        putCharXY(getWidth() - 2, 0, GraphicsChars.UPARROW, spinnerColor);
+        putCharXY(getWidth() - 1, 0, GraphicsChars.DOWNARROW, spinnerColor);
     }
 
     // ------------------------------------------------------------------------
@@ -177,7 +175,7 @@ public class TSpinner extends TWidget {
      */
     private void up() {
         if (upAction != null) {
-            upAction.DO();
+            upAction.DO(this);
         }
     }
 
@@ -186,7 +184,7 @@ public class TSpinner extends TWidget {
      */
     private void down() {
         if (downAction != null) {
-            downAction.DO();
+            downAction.DO(this);
         }
     }