Methods Summary |
---|
public void | addActionListener(java.awt.event.ActionListener l)
editor.addActionListener(l);
|
protected javax.swing.JTextField | createEditorComponent()Creates the internal editor component. Override this to provide
a custom implementation.
JTextField editor = new BorderlessTextField("",9);
editor.setBorder(null);
return editor;
|
public void | focusGained(java.awt.event.FocusEvent e)
|
public void | focusLost(java.awt.event.FocusEvent e)
|
public java.awt.Component | getEditorComponent()
return editor;
|
public java.lang.Object | getItem()
Object newValue = editor.getText();
if (oldValue != null && !(oldValue instanceof String)) {
// The original value is not a string. Should return the value in it's
// original type.
if (newValue.equals(oldValue.toString())) {
return oldValue;
} else {
// Must take the value from the editor and get the value and cast it to the new type.
Class cls = oldValue.getClass();
try {
Method method = cls.getMethod("valueOf", new Class[]{String.class});
newValue = method.invoke(oldValue, new Object[] { editor.getText()});
} catch (Exception ex) {
// Fail silently and return the newValue (a String object)
}
}
}
return newValue;
|
public void | removeActionListener(java.awt.event.ActionListener l)
editor.removeActionListener(l);
|
public void | selectAll()
editor.selectAll();
editor.requestFocus();
|
public void | setItem(java.lang.Object anObject)Sets the item that should be edited.
if ( anObject != null ) {
editor.setText(anObject.toString());
oldValue = anObject;
} else {
editor.setText("");
}
|