-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmptyButton.java
More file actions
52 lines (46 loc) · 1.67 KB
/
EmptyButton.java
File metadata and controls
52 lines (46 loc) · 1.67 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
48
49
50
51
52
/**
* Lead Author:
* Ian Kligman; 5550139764
*
* References:
* Gaddis, T. (2015). Starting Out With Java Myprogramming Lab
* From Control Structures Through Objects. (6th ed.). Addison-Wesley.
*
*
* Version: 12/12/2022
*/
/**
* |-----------------------------------------------------------|
* | EmptyButton |
* |-----------------------------------------------------------|
* | Responsibilities | Collaborating Classes |
* |-------------------------------+---------------------------|
* | Create functionality | |
* | of the buttons | EmptyButtonListener |
* | | TreasureButton |
* | Shows empty when clicked | TreasureGame |
* | | |
* |-------------------------------+---------------------------|
*/
// Required library imports for GUI and event listeners.
import javax.swing.*;
import java.awt.*;
public class EmptyButton extends JButton
{
public GameInfoPanel info;
private ImageIcon notreasure = new ImageIcon("notreasure.PNG");
private ImageIcon empty = new ImageIcon("empty.JPG");
// Purpose: Constructor takes in the info panel and styles the unclicked button.
public EmptyButton(GameInfoPanel inputInfo)
{
info = inputInfo;
setIcon(empty);
setBackground(Color.WHITE);
setDisabledIcon(notreasure);
}
// Purpose: Determine how a disabled empty button should be revealed at end game.
public void reveal()
{
setDisabledIcon(empty);
}
}