JPanel reportPane = new JPanel(gbl); reportPane.setOpaque(false); reportPane.setVisible(model.hasMessages());
JPanel reportPane = new JPanel(gbl); reportPane.setOpaque(false); reportPane.setVisible(model.hasMessages());
/** * Creates and returns a text area wrapped by a scroll pane that is * intended to show validation messages. The component is bound to * the given {@link ValidationResultModel}: the text content reflects * the validation result message text and the component is visible * if and only if the model has messages. * * @param model the model that provides the observable validation result * @param backgroundColor the color used to paint the area's background * @return a scrollable text component intended to show validation messages */ public static JComponent createReportTextPane(ValidationResultModel model, Color backgroundColor) { JTextArea area = createReportTextArea(model, backgroundColor); JScrollPane scrollPane = new JScrollPane(area); scrollPane.setVisible(model.hasMessages()); model.addPropertyChangeListener( ValidationResultModel.PROPERTYNAME_MESSAGES, new MessageStateChangeHandler(scrollPane)); return scrollPane; }
/** * Creates and returns a text area wrapped by a scroll pane that is * intended to show validation messages. The component is bound to * the given {@link ValidationResultModel}: the text content reflects * the validation result message text and the component is visible * if and only if the model has messages. * * @param model the model that provides the observable validation result * @param backgroundColor the color used to paint the area's background * @return a scrollable text component intended to show validation messages */ public static JComponent createReportTextPane(ValidationResultModel model, Color backgroundColor) { JTextArea area = createReportTextArea(model, backgroundColor); JScrollPane scrollPane = new JScrollPane(area); scrollPane.setVisible(model.hasMessages()); model.addPropertyChangeListener( ValidationResultModel.PROPERTY_MESSAGES, new MessageStateChangeHandler(scrollPane)); return scrollPane; }
/** * Creates and returns a list wrapped in a scroll pane that presents * validation messages. The list content is bound to the given * {@link ValidationResultModel} using a {@link ValidationResultListAdapter}. * * @param model the model that provides the observable validation result * @param backgroundColor the color used to paint the area's background * @return a {@code JList} that shows validation messages */ public static JComponent createReportList(ValidationResultModel model, Color backgroundColor) { JList list = new JList(); list.setFocusable(false); list.setBackground(backgroundColor); list.setCellRenderer(new BasicValidationMessageCellRenderer()); list.setModel(new ValidationResultListAdapter(model)); JScrollPane scrollPane = new JScrollPane(list); scrollPane.setVisible(model.hasMessages()); model.addPropertyChangeListener( ValidationResultModel.PROPERTY_MESSAGES, new MessageStateChangeHandler(scrollPane)); return scrollPane; }
/** * Creates and returns a list wrapped in a scroll pane that presents * validation messages. The list content is bound to the given * {@link ValidationResultModel} using a {@link ValidationResultListAdapter}. * * @param model the model that provides the observable validation result * @param backgroundColor the color used to paint the area's background * @return a <code>JList</code> that shows validation messages */ public static JComponent createReportList(ValidationResultModel model, Color backgroundColor) { JList list = new JList(); list.setFocusable(false); list.setBackground(backgroundColor); list.setCellRenderer(new BasicValidationMessageCellRenderer()); list.setModel(new ValidationResultListAdapter(model)); JScrollPane scrollPane = new JScrollPane(list); scrollPane.setVisible(model.hasMessages()); model.addPropertyChangeListener( ValidationResultModel.PROPERTYNAME_MESSAGES, new MessageStateChangeHandler(scrollPane)); return scrollPane; }