%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
com.aimedia.ui.UIPartFactory |
|
|
1 | /* |
|
2 | ******************************************************************************* |
|
3 | * Copyright (c) 2005 Chris Rose and AIMedia |
|
4 | * All rights reserved. UIPartFactory and the accompanying materials |
|
5 | * are made available under the terms of the Common Public License v1.0 |
|
6 | * which accompanies this distribution, and is available at |
|
7 | * http://www.eclipse.org/legal/cpl-v10.html |
|
8 | * |
|
9 | * Contributors: |
|
10 | * Chris Rose |
|
11 | *******************************************************************************/ |
|
12 | package com.aimedia.ui; |
|
13 | ||
14 | import java.awt.Font; |
|
15 | ||
16 | import javax.swing.JLabel; |
|
17 | ||
18 | /** |
|
19 | * A go-to class for generic UI components that we seem to spend too much |
|
20 | * effort re-implementing. If something needs to be build many times the same |
|
21 | * way, it's probably best to put a method to do so in here. |
|
22 | * |
|
23 | * @author Chris Rose |
|
24 | */ |
|
25 | public class UIPartFactory { |
|
26 | ||
27 | /** |
|
28 | * Not allowed to be instantiated. |
|
29 | */ |
|
30 | 0 | private UIPartFactory() {} |
31 | ||
32 | /** |
|
33 | * Return a label with the given text, right-aligned. |
|
34 | * @param text the text to use on the label. |
|
35 | * @return a <code>JLabel</code> object with the supplied text |
|
36 | */ |
|
37 | public static final JLabel createFieldLabel(String text) { |
|
38 | 0 | return createFieldLabel(text, false); |
39 | } |
|
40 | ||
41 | /** |
|
42 | * Return a label with the given text, right-aligned. |
|
43 | * @param text the text to use on the label. |
|
44 | * @param bold <code>true</code> if the label is to have boldface text, |
|
45 | * <code>false</code> otherwise. |
|
46 | * @return a <code>JLabel</code> object with the supplied text and font hints. |
|
47 | */ |
|
48 | public static final JLabel createFieldLabel(String text, boolean bold) { |
|
49 | 0 | JLabel label = new JLabel(text, JLabel.RIGHT); |
50 | 0 | if (bold) { |
51 | 0 | label.setFont(label.getFont().deriveFont(Font.BOLD)); |
52 | } |
|
53 | 0 | return label; |
54 | } |
|
55 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |