1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.commons.gui.pkg;
21
22 import java.awt.BorderLayout;
23 import java.awt.FlowLayout;
24 import java.awt.Font;
25 import javax.swing.Box;
26 import javax.swing.BoxLayout;
27 import javax.swing.JLabel;
28 import javax.swing.JPanel;
29 import javax.swing.JScrollPane;
30 import org.xnap.commons.gui.util.GUIHelper;
31 import org.xnap.commons.pkg.PackageInfo;
32
33 public class PackageInfoPanel extends JPanel {
34
35 private PackageInfo info;
36 private JLabel descriptionLabel;
37 private JLabel nameLabel;
38 private JPanel buttonsPanel;
39 private JLabel longDescriptionLabel;
40
41 public PackageInfoPanel()
42 {
43 setLayout(new BorderLayout());
44
45 Box box = Box.createVerticalBox();
46 box.setBorder(GUIHelper.createEmptyBorder(5));
47 add(box, BorderLayout.CENTER);
48
49 nameLabel = new JLabel();
50 nameLabel.setFont(nameLabel.getFont().deriveFont(Font.BOLD));
51 box.add(nameLabel);
52 box.add(Box.createVerticalStrut(5));
53
54 descriptionLabel = new JLabel();
55 box.add(descriptionLabel);
56 box.add(Box.createVerticalStrut(10));
57
58 longDescriptionLabel = new JLabel();
59 box.add(longDescriptionLabel);
60
61 buttonsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5));
62 add(buttonsPanel, BorderLayout.SOUTH);
63 }
64
65 public JPanel getButtonPanel()
66 {
67 return buttonsPanel;
68 }
69
70 /***
71 * Updates the package info panel.
72 */
73 public void setInfo(PackageInfo info)
74 {
75 this.info = info;
76
77 nameLabel.setText(info.getName() + " " + info.getVersion());
78 descriptionLabel.setText(GUIHelper.tt(info.getDescription()));
79 longDescriptionLabel.setText(GUIHelper.tt(info.getLongDescription()));
80 }
81
82
83
84 }