-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathState.java
More file actions
29 lines (26 loc) · 931 Bytes
/
Copy pathState.java
File metadata and controls
29 lines (26 loc) · 931 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
import javax.swing.*;
import java.awt.event.*;
public class State extends AutoChangeButton
{
public State(Money m)
{
super(new JButton("Get a State: $" + 10000),10000,100);
class ClicksListener implements ActionListener
{
public void actionPerformed(ActionEvent event)
{
if(m.getMoney() >= getCost())
{
m.setChangeAuto(m.getChangeAuto() + getChange());
m.updateAutoPower("Money per Second: $" + m.getChangeAuto());
m.decreaseMoney(getCost());
setCost((int) Math.round(getCost() * 1.15));
changeJButtonText("Get a State: $" + getCost());
m.updateMoneyViewer("Money: $" + m.getMoney());
}
}
}
ActionListener listener = new ClicksListener();
addAction(listener);
}
}