-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClickChanger.java
More file actions
47 lines (41 loc) · 1.35 KB
/
Copy pathClickChanger.java
File metadata and controls
47 lines (41 loc) · 1.35 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import javax.swing.*;
import java.awt.event.*;
//The purpose of this class is to change the power of the click
public class ClickChanger implements Button
{
private JButton powerButton;
private int cost;
private int change;
public ClickChanger(MainClicker b, Money m)
{
cost = 100;
change = 1;
powerButton = new JButton("Increase click power $" + cost);
m.updateClickPower("Clicking power: $" + m.getChangeClick());
class ClicksListener implements ActionListener
{
public void actionPerformed(ActionEvent event)
{
if(m.getMoney()>=cost)
{
m.setChangeClick(m.getChangeClick() + change);
m.decreaseMoney(cost);
cost = cost * 10;
powerButton.setText("Increase click power $" + cost);
m.updateMoneyViewer("Money: $" + m.getMoney());
m.updateClickPower("Clicking power: $" + m.getChangeClick());
}
}
}
ActionListener listener = new ClicksListener();
powerButton.addActionListener(listener);
}
public JButton getButton()
{
return powerButton;
}
public void setBoundsOfButton(int x, int y, int w, int h)
{
powerButton.setBounds(x, y, w, h);
}
}