| | |
| | | package org.opends.quicksetup.ui; |
| | | |
| | | import java.awt.Color; |
| | | import java.awt.Component; |
| | | import java.awt.Font; |
| | | import java.awt.Image; |
| | | import java.awt.Insets; |
| | |
| | | import javax.swing.JEditorPane; |
| | | import javax.swing.JFrame; |
| | | import javax.swing.JLabel; |
| | | import javax.swing.JList; |
| | | import javax.swing.JPasswordField; |
| | | import javax.swing.JRadioButton; |
| | | import javax.swing.JScrollBar; |
| | | import javax.swing.JScrollPane; |
| | | import javax.swing.JTextField; |
| | | import javax.swing.ListCellRenderer; |
| | | import javax.swing.UIManager; |
| | | import javax.swing.border.Border; |
| | | import javax.swing.border.EmptyBorder; |
| | |
| | | public static final Color PROGRESS_COLOR = Color.BLACK; |
| | | |
| | | /** |
| | | * Specifies the instructions text color. |
| | | */ |
| | | public static final Color INSTRUCTIONS_COLOR = Color.BLACK; |
| | | |
| | | /** |
| | | * Specifies the text field text color. |
| | | */ |
| | | public static final Color TEXTFIELD_COLOR = Color.BLACK; |
| | |
| | | Font.decode("Arial-PLAIN-14"); |
| | | |
| | | /** |
| | | * Specifies the font for the instructions of the current panel. |
| | | */ |
| | | public static final Font INSTRUCTIONS_MONOSPACE_FONT = |
| | | Font.decode("Monospaced-PLAIN-14"); |
| | | |
| | | /** |
| | | * Specifies the font for the primary valid field. |
| | | */ |
| | | public static final Font PRIMARY_FIELD_VALID_FONT = |
| | |
| | | */ |
| | | PROGRESS, |
| | | /** |
| | | * Text style for the instructions. |
| | | */ |
| | | INSTRUCTIONS, |
| | | /** |
| | | * No text style. |
| | | */ |
| | | NO_STYLE |
| | |
| | | } |
| | | |
| | | /** |
| | | * Creates a JList. |
| | | * |
| | | * @param textStyle the style to be used for the renderer. |
| | | * @return a JList. |
| | | */ |
| | | public static JList makeJList(TextStyle textStyle) |
| | | { |
| | | JList list = new JList(); |
| | | list.setCellRenderer(makeCellRenderer(textStyle)); |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * Sets the specified text style to the component passed as parameter. |
| | | * @param l the component to update. |
| | | * @param style the text style to use. |
| | |
| | | l.setForeground(PROGRESS_COLOR); |
| | | break; |
| | | |
| | | case INSTRUCTIONS: |
| | | l.setFont(INSTRUCTIONS_FONT); |
| | | l.setForeground(INSTRUCTIONS_COLOR); |
| | | break; |
| | | |
| | | case TEXTFIELD: |
| | | l.setFont(UIFactory.TEXTFIELD_FONT); |
| | | l.setForeground(TEXTFIELD_COLOR); |
| | |
| | | } |
| | | return tooltip; |
| | | } |
| | | |
| | | private static ListCellRenderer makeCellRenderer(final TextStyle textStyle) |
| | | { |
| | | ListCellRenderer renderer = new ListCellRenderer() |
| | | { |
| | | public Component getListCellRendererComponent(JList list, |
| | | Object value, |
| | | int index, |
| | | boolean isSelected, |
| | | boolean cellHasFocus) |
| | | { |
| | | JLabel l = makeJLabel(IconType.NO_ICON, (String)value, textStyle); |
| | | l.setBorder(new EmptyBorder(TOP_INSET_SECONDARY_FIELD, 0, 0, 0)); |
| | | return l; |
| | | } |
| | | }; |
| | | return renderer; |
| | | } |
| | | } |
| | | |
| | | /** |