-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNextButton.java
More file actions
executable file
·31 lines (28 loc) · 926 Bytes
/
NextButton.java
File metadata and controls
executable file
·31 lines (28 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class NextButton here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class NextButton extends Button {
private boolean ifDiscbetion = false;
private GreenfootImage unclickedCycleButton = new GreenfootImage("button/buttonR_unpressed.png");
private GreenfootImage clickedCycleButton = new GreenfootImage("button/buttonR_pressed.png");
public NextButton() {
super(false);
clickedCycleButton.scale(32, 32);
unclickedCycleButton.scale(32, 32);
}
/**
* Act - do whatever the NextButton wants to do. This method is called whenever the 'Act' or 'Run'
* button gets pressed in the environment.
*/
public void act() {
if (Greenfoot.mouseClicked(this)) {
setImage(clickedCycleButton);
} else {
setImage(unclickedCycleButton);
}
}
}