-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButtonPanel.java
More file actions
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
import java.awt.*;
import javax.swing.*;
import javax.swing.border.Border;
public class ButtonPanel extends JPanel {
private JButton addTask;
private JButton clear;
Border emptyBorder = BorderFactory.createEmptyBorder();
public ButtonPanel() {
// Set up the layout and background
this.setPreferredSize(new Dimension(400, 60));
this.setBackground(Color.LIGHT_GRAY);
this.setLayout(new FlowLayout(FlowLayout.CENTER, 20, 10));
// Create the buttons once
addTask = new JButton("Add Task");
clear = new JButton("Clear Completed Tasks");
// Style the buttons
Border emptyBorder = BorderFactory.createEmptyBorder();
addTask.setBorder(emptyBorder);
addTask.setFont(new Font("Arial", Font.PLAIN, 20));
clear.setBorder(emptyBorder);
clear.setFont(new Font("Arial", Font.PLAIN, 20));
// Add to panel
this.add(addTask);
this.add(clear);
}
public JButton getAddTask() {
return addTask;
}
public JButton getClear() {
return clear;
}
}