-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathInfoPanel.java
62 lines (51 loc) · 1.88 KB
/
InfoPanel.java
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
62
package DTCController;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class InfoPanel extends JDialog implements ActionListener {
public final static Font fFont = new Font("monospaced",Font.PLAIN,12);
JTextArea carInfoArea;
JTextArea csInfoArea;
JButton dismissButton;
public InfoPanel(Dump d) {
JPanel innerPanel = new JPanel();
innerPanel.setLayout(null);
innerPanel.setPreferredSize(new Dimension(500, 450));
carInfoArea = new JTextArea();
carInfoArea.setEditable(false);
carInfoArea.setBorder(BorderFactory.createTitledBorder("Possible car(s)"));
CarItem[] items = CarInfo.getCars(d.software);
StringBuffer carInfos = new StringBuffer();
for(int i=0;i<items.length;i++) {
carInfos.append(items[i]);
carInfos.append('\n');
}
carInfoArea.setText(carInfos.toString());
carInfoArea.setBounds(5,5,490,100);
innerPanel.add(carInfoArea);
csInfoArea = new JTextArea();
csInfoArea.setEditable(false);
csInfoArea.setFont(fFont);
csInfoArea.setBorder(BorderFactory.createTitledBorder("Checksum info"));
csInfoArea.setText(ChecksumHelper.getCSinfos(d.memory));
csInfoArea.setBounds(5,110,490,300);
innerPanel.add(csInfoArea);
dismissButton = new JButton("Dismiss");
dismissButton.addActionListener(this);
dismissButton.setBounds(395,420,95,25);
innerPanel.add(dismissButton);
setContentPane(innerPanel);
setTitle("Info panel");
pack();
setLocationRelativeTo(null);
setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
if( e.getSource()==dismissButton ) {
dispose();
setVisible(false);
}
}
}