| | |
| | | import javax.swing.text.html.HTMLEditorKit; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | /** |
| | | * This class provides constants an methods to create Swing objects and to |
| | |
| | | */ |
| | | public class UIFactory |
| | | { |
| | | private static boolean initialized; |
| | | private static String parentPackagePath; |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** Specifies the horizontal insets between buttons. */ |
| | | public static final int HORIZONTAL_INSET_BETWEEN_BUTTONS = 5; |
| | |
| | | } |
| | | |
| | | /** |
| | | * This method initialize the look and feel and UI settings specific to quick |
| | | * setup. |
| | | * |
| | | * @throws Throwable |
| | | * if there is a problem initializing the look and feel. |
| | | */ |
| | | public static void initialize() throws Throwable |
| | | { |
| | | if (!initialized) |
| | | { |
| | | try |
| | | { |
| | | UIManager.put("OptionPane.background", getColor(INFO_OPTIONPANE_BACKGROUND_COLOR.get())); |
| | | UIManager.put("Panel.background", getColor(INFO_PANEL_BACKGROUND_COLOR.get())); |
| | | UIManager.put("ComboBox.background", getColor(INFO_COMBOBOX_BACKGROUND_COLOR.get())); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | // This might occur when we do not get the display |
| | | logger.warn(LocalizableMessage.raw("Error updating UIManager: " + t, t)); |
| | | } |
| | | initializeLookAndFeel(); |
| | | initialized = true; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Creates a new JPanel. |
| | | * |
| | | * @return JPanel newly created |