1
2
3
4
5
6
7
8
9
10
11
12
13
14 package org.gscg.gameleader.dialogs.components;
15
16 import java.awt.Color;
17
18 import javax.swing.JLabel;
19 import javax.swing.JPanel;
20
21 /***
22 * The AbstractPanel extends the JPanel and makes sure each class extending from
23 * this one has an initialize method which formats the JPanel. The
24 * DialogPanelFactory expects the panels it loads to be extensions of the
25 * AbstractPanel class.
26 * <p>
27 *
28 * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
29 * Delft, the Netherlands. All rights reserved.
30 *
31 * See for project information <a href="http://www.simulation.tudelft.nl/">
32 * www.simulation.tudelft.nl </a>.
33 *
34 * The source code and binary code of this software is proprietary information
35 * of Delft University of Technology.
36 *
37 * @author <a
38 * href="http://www.tbm.tudelft.nl/webstaf/stijnh/index.htm">Stijn-Pieter
39 * van Houten </a>
40 * @version $Revision: 1.1 $ $Date: 2005/06/16 12:34:09 $
41 * @since 1.0.3
42 */
43 public abstract class AbstractPanel extends JPanel
44 {
45 /*** the preferred width */
46 public static final int PREFERRED_WIDTH = 150;
47
48 /*** the name */
49 private String name = "";
50
51 /***
52 * constructs a new AbstractPanel
53 *
54 * @param name the name of the panel
55 */
56 public AbstractPanel(final String name)
57 {
58 super();
59 this.name = name;
60 this.setBackground(Color.WHITE);
61 }
62
63 /***
64 * Method initialize.
65 */
66 protected abstract void initialize();
67
68 /***
69 * Method getFormattedLabel returns a formatted label
70 *
71 * @param text the text for the label
72 * @return returns a formatted label
73 */
74 protected JLabel getFormattedLabel(final String text)
75 {
76 JLabel label = new JLabel(text);
77 label.setBackground(Color.WHITE);
78 return label;
79 }
80
81 /***
82 * @see java.awt.Component#getName()
83 */
84 public String getName()
85 {
86 return this.name;
87 }
88 }