-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButtonsPanel.java
More file actions
48 lines (44 loc) · 1.38 KB
/
ButtonsPanel.java
File metadata and controls
48 lines (44 loc) · 1.38 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
import java.awt.Choice;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.io.Serializable;
import javax.swing.JButton;
import javax.swing.JPanel;
public class ButtonsPanel extends JPanel implements Serializable{
/**
* ButtonsPanel contains all the 4 buttons and the choice component of a player's cluster
*/
private static final long serialVersionUID = 1L;
//attributes
JButton sit,hit,hold,bet; //4 buttons
Choice bettingAmount; //a choice component
//constructor
public ButtonsPanel(JButton sit,JButton hit, JButton hold, JButton bet, Choice bettingAmount) {
this.sit=sit;
this.hit=hit;
this.hold=hold;
this.bet=bet;
this.bettingAmount=bettingAmount;
this.setLayout(new FlowLayout());
this.setBackground(Color.DARK_GRAY);
buttons(); //calling of buttons method to add the buttons to the panel
}
public void buttons() {
this.add(sit);
this.add(hit);
this.add(hold);
this.add(bet);
this.add(bettingAmount);
sit.setPreferredSize(new Dimension (39,30));
hit.setPreferredSize(new Dimension (39,30));
hold.setPreferredSize(new Dimension (39,30));
bet.setPreferredSize(new Dimension (39,30));
bettingAmount.setPreferredSize(new Dimension(80,30));
sit.setEnabled(false);
hit.setEnabled(false);
hold.setEnabled(false);
bet.setEnabled(false);
bettingAmount.setEnabled(false);
}
}