View Javadoc

1   // %1126721045619:hoplugins.commons.ui%
2   package hoplugins.commons.ui;
3   
4   import javax.swing.JLabel;
5   import javax.swing.JPanel;
6   
7   import java.awt.GridBagConstraints;
8   import java.awt.GridBagLayout;
9   import java.awt.Insets;
10  
11  /***
12   * An info customizable panel, it shows the Strings passed thru constructor!!!
13   *
14   * @author <a href=mailto:draghetto@users.sourceforge.net>Massimiliano Amato</a>
15   */
16  public class InfoPanel extends JPanel {
17      /***
18       * Constructs a new instance.
19       *
20       * @param messages TODO Missing Constructuor Parameter Documentation
21       */
22      public InfoPanel(String[] messages) {
23          jbInit(messages);
24      }
25  
26      /***
27       * Initializes the state of this instance.
28       *
29       * @param messages TODO Missing Constructuor Parameter Documentation
30       */
31      private void jbInit(String[] messages) {
32          GridBagLayout gridBagLayout1 = new GridBagLayout();
33  
34          this.setLayout(gridBagLayout1);
35  
36          JLabel[] labels = new JLabel[messages.length];
37  
38          for (int i = 0; i < labels.length; i++) {
39              labels[i] = new JLabel();
40              labels[i].setText(messages[i]);
41              add(labels[i],
42                  new GridBagConstraints(0, i, 1, 1, 0.0, 0.0,
43                      GridBagConstraints.WEST, GridBagConstraints.NONE,
44                      new Insets(5, 5, 0, 5), 0, 0));
45          }
46      }
47  }