sanjay_thakur
asked on
TreeCellEditor problem
Hi,
This is a weird thing
I JBuilder I define a class like
public class AbstractCellEditor implements TableCellEditor,TreeCellEd itor
{
//some code
}
I get an error
"AbstractCellEditor.java": Error #: 453 : not an interface at line 22, column 60
(JBuilder version: JBuilder 4 foundation 4.0.1.52.0 ,
I know that TreeCellEditor and TableCellEditor are interfaces
why can't I extend these Interfaces?
Any help
This is a weird thing
I JBuilder I define a class like
public class AbstractCellEditor implements TableCellEditor,TreeCellEd
{
//some code
}
I get an error
"AbstractCellEditor.java":
(JBuilder version: JBuilder 4 foundation 4.0.1.52.0 ,
I know that TreeCellEditor and TableCellEditor are interfaces
why can't I extend these Interfaces?
Any help
> public class AbstractCellEditor implements TableCellEditor,TreeCellEd itor
> why can't I extend these Interfaces?
Your not extending the interfaces, your implementing them?
> why can't I extend these Interfaces?
Your not extending the interfaces, your implementing them?
ASKER
Hi,
I have defined all the methods required but
I still cannot compile the program
I have defined all the methods required but
I still cannot compile the program
Can u post the code.
ASKER
Here is the code for my class
when I compile it in JBuilder
I get the error
"TestCellEditor.java": Error #: 453 : not an interface at line 22, column 60
public class TestCellEditor implements TableCellEditor,TreeCellEd
{
protected EventListenerList listenerList =new
EventListenerList();
protected Object value;
protected ChangeEvent changeEvent = null;
protected int clickCountToStart = 1;
public Object getCellEditorValue() {
return value;
}
public void setCellEditorValue(Object value) {
this.value = value;
}
public void setClickCountToStart(int count) {
clickCountToStart = count;
}
public int getClickCountToStart() {
return clickCountToStart;
}
public boolean isCellEditable(EventObject
if (anEvent instanceof MouseEvent) {
if (((MouseEvent)anEvent).get
clickCountToStart)
return false;
}
return true;
}
public boolean shouldSelectCell(EventObje
if (this.isCellEditable(anEve
if (anEvent == null ||
((MouseEvent)anEvent).getC
clickCountToStart)
return true;
}
return false;
}
public boolean stopCellEditing() {
fireEditingStopped();
return true;
}
public void cancelCellEditing() {
fireEditingCanceled();
}
public void addCellEditorListener(Cell
listenerList.add(CellEdito
}
public void removeCellEditorListener(C
listenerList.remove(CellEd
}
public Component getTreeCellEditorComponent
JTree tree, Object value,
boolean isSelected,
boolean expanded,
boolean leaf, int row) {
return null;
}
public Component getTableCellEditorComponen
JTable table, Object value,
boolean isSelected,
int row, int column) {
return null;
}
protected void fireEditingStopped() {
Object[] listeners = listenerList.getListenerLi
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==CellEditorL
if (changeEvent == null)
changeEvent = new ChangeEvent(this);
((CellEditorListener)
listeners[i+1]).editingSto
}
}
}
protected void fireEditingCanceled() {
Object[] listeners = listenerList.getListenerLi
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==CellEditorL
if (changeEvent == null)
changeEvent = new ChangeEvent(this);
((CellEditorListener)
listeners[i+1]).editingCan
}
}
}
}
Any help?
p.s :If I declare the class as
public class TestCellEditor implements TableCellEditor
Things are fine.
only TreeCellEditor seems to have a problem!
Hi,
Are you sure you import TreeCellEditor? I cannot imagine what other problem you might have.
Regards,
Igor Bazarny
Are you sure you import TreeCellEditor? I cannot imagine what other problem you might have.
Regards,
Igor Bazarny
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes
If I just Implement TreeCellEditor it gives the same error
"AbstractCellEditor.java":
I compiled it at the command prompt
It seems to be ok.
But in JBuilder I cannot!
I am still not able to edit the check boxes
Any help
some source code will be really helpful
thanks
What checkboxes?
If it compiles ok from the command line then there's nothing wrong with your code, it's a JBuilder problem.
ASKER
sorry for the delay again
TableCellEditor and TreeCellEditor are subinterfaces of CellEditor and therefore all methods of CellEditor must also be defined if you implement these interfaces.
The methods which are required by CellEditor are:
void addCellEditorListener(Cell
void cancelCellEditing()
Object getCellEditorValue()
boolean isCellEditable(EventObject
void removeCellEditorListener(C
boolean shouldSelectCell(EventObje
boolean stopCellEditing()