public void init(PropertyDescriptor descriptor) {
if (textfield == null)
{
textfield = new JTextField();
textfield.setDocument(new FloatNumberDocument());
// disable editing if its a readonly property
if( descriptor.getWriteMethod() == null ) textfield.setEditable( false );
textfield.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
String text = textfield.getText();
if( text.length() == 0 ) text = "0";
setValue(new Double(text));
}
});
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.add(textfield);
}
}
Initializes this property editor |