What is the difference between JTextField.setEnabled()
and JTextField.setEditable()
?
In my code I have an Instance of a class inherited from JTextField
. But when I set its property setEnabled(false)
I can still edit and process its contents in my program. However when I set its property setEditable(false)
I can no longer edit its text. If it is so. Then what is the purpose of setEnabled()
property here?
My Code for inherited class is:
private static class CCField extends JTextField{
private static final long serialVersionUID = 1L;
public CCField() {
this( DEFAULT_COLUMN_COUNT );
}
public CCField(final int cols) {
super( cols );
}
Added INFO
When I call the setEnabled()
property of this class it does not show any effect on the text field and it still remains enabled. I have a container Jcomponent
in my code which have this CCField
as a child component. So when I try to disable it using setEnabled(false)
it still editable. Whereas when I try to disable it using setEditable(false)
then it is disabled.
This is how I am accessing this textField in my container:
JComponent jComp = DDEUtil.getComponent(icTableLayout,icDS);
((JTextField)jComp.getComponent(1)).setEditable(false);
And what is going on in DDEUtil.getComponent
is too complex as it involve a number of classes and not possible to post here.
I wonder I have not overridden any method of this component so why is it showing this behavior.