/** * Creates and returns a text area that is intended to show validation * messages. The area 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 * @return a text area intended to show validation messages */ public static JTextArea createReportTextArea(ValidationResultModel model) { return createReportTextArea(model, DEFAULT_REPORT_BACKGROUND); }
/** * Creates and returns a text area that is intended to show validation * messages. The area 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 * @return a text area intended to show validation messages */ public static JTextArea createReportTextArea(ValidationResultModel model) { return createReportTextArea(model, DEFAULT_REPORT_BACKGROUND); }
JTextArea area = createReportTextArea(model); area.setOpaque(false);
JTextArea area = createReportTextArea(model); area.setOpaque(false);
/** * 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 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; }