The Renderer class is used to display property values. This values can be represented e.g. as text or as a check box.
The renderer gets the prviously from the Converter created Object an has to return the Object as JComponent.
a new Renderer class should extend the class AbstractGroupRenderer, wich prescribes the methods
String makeToolTipLine(Object arg0)
JComponent createRendererComponent()
and
void setValue(Object arg0)
Example of a Renderer class:
public class LabelRenderer extends AbstractGroupRenderer { private JLabel lab; protected String makeToolTipLine(Object arg0) { return null; } protected JComponent createRendererComponent() { return lab = new JLabel(); } protected void setValue(Object arg0) { lab.setText((arg0 == null )? "" : arg0); } }
The method
String makeToolTipLine(Object arg0)
is used for the representation as the text of the Tooltips in the Form- and Reporteditor .
The method
JComponent createRendererComponent()
creates a grafical object to represent the property value.
The method
void setValue(Object arg0)
sets the value of the graphical object. In the example, the marking will be set as text of the JLabel.
The LabelRenderer class can now be registered in the Bean-Schema.