- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelectionPanel.java
More file actions
Latest commit
61 lines (47 loc) · 1.52 KB
/
Copy pathSelectionPanel.java
File metadata and controls
61 lines (47 loc) · 1.52 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
53
54
55
56
57
58
59
60
61
importjava.awt.Dimension;
importjava.awt.GridBagConstraints;
importjava.awt.GridBagLayout;
importjava.awt.Insets;
importjava.awt.event.ActionEvent;
importjava.awt.event.ActionListener;
importjavax.swing.JButton;
importjavax.swing.JFrame;
importjavax.swing.JLabel;
importjavax.swing.JPanel;
publicclassSelectionPanelextendsJPanel{
publicSelectionPanel(JFrameframe) {
super();
this.setLayout(newGridBagLayout());
GridBagConstraintsc = newGridBagConstraints();
c.insets = newInsets(10,0,0,0);
c.fill = GridBagConstraints.HORIZONTAL;
c.gridwidth=2;
this.setPreferredSize(newDimension(300,300));
JLabeltitle = newJLabel("Select the type of circuit");
title.setHorizontalAlignment(JLabel.CENTER);
this.add(title, c);
c.gridwidth=1;
c.insets = newInsets(50,0,0,0);
c.gridy=1;
JButtonbtResistance = newJButton("Resistances");
btResistance.addActionListener(newActionListener() {
@Override
publicvoidactionPerformed(ActionEventarg0) {
// TODO Auto-generated method stub
frame.dispose();
CircuitFramecf = newCircuitFrame(true);
}
});
this.add(btResistance,c);
JButtonbtCapacitors = newJButton("Capacitors");
btCapacitors.addActionListener(newActionListener() {
@Override
publicvoidactionPerformed(ActionEventarg0) {
// TODO Auto-generated method stub
frame.dispose();
CircuitFramecf = newCircuitFrame(false);
}
});
this.add(btCapacitors,c);
}
}