- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButtonPanel.java
More file actions
Latest commit
42 lines (32 loc) · 1.13 KB
/
Copy pathButtonPanel.java
File metadata and controls
42 lines (32 loc) · 1.13 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
importjava.awt.*;
importjavax.swing.*;
importjavax.swing.border.Border;
publicclassButtonPanelextendsJPanel {
privateJButtonaddTask;
privateJButtonclear;
BorderemptyBorder = BorderFactory.createEmptyBorder();
publicButtonPanel() {
// Set up the layout and background
this.setPreferredSize(newDimension(400, 60));
this.setBackground(Color.LIGHT_GRAY);
this.setLayout(newFlowLayout(FlowLayout.CENTER, 20, 10));
// Create the buttons once
addTask = newJButton("Add Task");
clear = newJButton("Clear Completed Tasks");
// Style the buttons
BorderemptyBorder = BorderFactory.createEmptyBorder();
addTask.setBorder(emptyBorder);
addTask.setFont(newFont("Arial", Font.PLAIN, 20));
clear.setBorder(emptyBorder);
clear.setFont(newFont("Arial", Font.PLAIN, 20));
// Add to panel
this.add(addTask);
this.add(clear);
}
publicJButtongetAddTask() {
returnaddTask;
}
publicJButtongetClear() {
returnclear;
}
}