-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathToolbar.java
More file actions
36 lines (25 loc) · 854 Bytes
/
Toolbar.java
File metadata and controls
36 lines (25 loc) · 854 Bytes
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
package swingGUI;
import javax.swing.*;
import java.awt.*;
public class Toolbar extends JPanel {
private Integer[] sidesNo = { 0, 3, 4, 5, 6, 7, 8 };
private JLabel shapeNoLabel = new JLabel("Shapes number: ");
private JLabel radiusLabel = new JLabel("Radius: ");
JTextField shapesNo = new JFormattedTextField();
JTextField shapesRadius = new JFormattedTextField();
JButton drawButton = new JButton("Draw");
public Toolbar(DrawingFrame frame) {
this.setBorder(BorderFactory.createTitledBorder("Toolbar"));
init();
this.setLayout(new GridLayout(2,4, 20, 0));
}
private void init() {
shapesRadius.setText("5");
shapesNo.setText("1");
add(shapeNoLabel);
add(radiusLabel);
add(drawButton);
add(shapesNo);
add(shapesRadius);
}
}