1 /*
2 * Created on Nov 18, 2003
3 *
4 * To change the template for this generated file go to
5 * Window>Preferences>Java>Code Generation>Code and Comments
6 */
7 package portaview;
8
9 import javax.swing.BorderFactory;
10 import javax.swing.JLabel;
11 import javax.swing.SwingConstants;
12
13 /***
14 * Factory class to generate common swing widgets.
15 * @author William Lee
16 */
17 public class WidgetFactory
18 {
19 /***
20 * Generates a label that is centered.
21 * @param txt text for the label
22 * @return a JLabel that is centered.
23 */
24 public static JLabel createCenteredLabel(String txt)
25 {
26 JLabel rtn = new JLabel(txt);
27 rtn.setHorizontalAlignment(SwingConstants.CENTER);
28 rtn.setVerticalAlignment(SwingConstants.CENTER);
29 rtn.setBorder(BorderFactory.createEtchedBorder());
30 return rtn;
31 }
32 }
This page was automatically generated by Maven