Adds debug output.
@@ -108,7 +108,9 @@ public class Button extends Component {
@Override
public void mousePressed(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
+ System.out.println("Pressed");
if (intersects(e, fontWidth, fontHeight)) {
+ System.out.println("Pressed & intersects");
setStatePressed();
}
}
@@ -118,12 +120,15 @@ public class Button extends Component {
public void mouseReleased(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
if (isInPressedState) {
+ System.out.println("Released & Running");
onClickFunction.run();
}
if (intersects(e, fontWidth, fontHeight)) {
+ System.out.println("Released & Hovering");
setStateHovered();
} else {
+ System.out.println("Released & Normal");
setStateNormal();
}
}
@@ -149,8 +154,10 @@ public class Button extends Component {
@Override
public void mouseMoved(MouseEvent e) {
if (intersects(e, fontWidth, fontHeight)) {
+ System.out.println("Moved & Hovering");
setStateHovered();
} else {
+ System.out.println("Moved & Normal");
setStateNormal();
}
}
