Board index » jbuilder » Set a cell editable...

Set a cell editable...


2004-04-01 12:01:20 PM
jbuilder12
I am looking for a code example to make a specific cell in
a jdbTable as editable or not editable without changes in the DataSet
Thanks in advance for your help&suggestions.
 
 

Re:Set a cell editable...

Mauricio Meza wrote:
Quote
I am looking for a code example to make a specific cell in
a jdbTable as editable or not editable without changes in the DataSet

Thanks in advance for your help&suggestions.
Try this (using a MousePressedEvent below to stop editing on a specific
column, any selected row)
void jdbTable1_mousePressed(MouseEvent e) {
/* the 2 as second param is the ColumnNumber
TableCellEditor tce= jdbTable1.getCellEditor
(jdbTable1.getSelectedRow(),2);
tce.cancelCellEditing();
}
 

Re:Set a cell editable...

<posted & mailed>
pnichols wrote:
Sorry, you wanted it both ways:
void jdbTable1_mousePressed(MouseEvent e) {
TableCellEditor tce=null;
if (e.getClickCount() < 2) {
tce= jdbTable1.getCellEditor(jdbTable1.getSelectedRow(),
2);
tce.cancelCellEditing();
}
else if (e.getClickCount()==2) {
jdbTable1.setEditable(true);
}
* Note: just for a sample. I have no idea how you want to trigger the events
on Cell Editing.
 

{smallsort}

Re:Set a cell editable...

Another way to implement this, is to override the
public boolean isCellEditable(int row, int column)
method from JdbTable.
Olaf Raether
On Wed, 31 Mar 2004 22:01:20 -0600, "Mauricio Meza"
< XXXX@XXXXX.COM >wrote:
Quote
I am looking for a code example to make a specific cell in
a jdbTable as editable or not editable without changes in the DataSet

Thanks in advance for your help&suggestions.

 

Re:Set a cell editable...

Olaf Raether wrote:
Quote
Another way to implement this, is to override the

public boolean isCellEditable(int row, int column)

method from JdbTable.


Unless I am mistaken, that only returns a boolean as to whether the cell is
editable or not. It will not set the edit conditions on that particular
cell.
Of course He could create his own class from TableCellRenderer, but that
would be overkill, IMHO, for what he wants to do.
 

Re:Set a cell editable...

You have to override JdbTable like this:
public class MyJdbTable extends com.borland.dbswing.JdbTable {
public boolean isCellEditable(int row, int column) {
return true; // Or false. you have to place to code here
}
}
Olaf Raether
On Thu, 01 Apr 2004 03:58:03 -0500, pnichols < XXXX@XXXXX.COM >wrote:
Quote
Olaf Raether wrote:

>Another way to implement this, is to override the
>
>public boolean isCellEditable(int row, int column)
>
>method from JdbTable.
>
>
Unless I am mistaken, that only returns a boolean as to whether the cell is
editable or not. It will not set the edit conditions on that particular
cell.

Of course He could create his own class from TableCellRenderer, but that
would be overkill, IMHO, for what he wants to do.
 

Re:Set a cell editable...

Thks guys for your answers .... but overriding the isCellEditable Method, I
just get a boolean value
and I want a set the editable propertie in a specific cell, not in the
entire jdbTable
... and pnichols .. Is the TableCellEditor an interface, isn't it? ...I get
a error when I try to instantiate it.. finally I play with the
getSelectedColumn() and setEditable() methods to solve the problem.
Thks in advance ... & sorry for my english
 

Re:Set a cell editable...

Olaf Raether wrote:
Quote
You have to override JdbTable like this:

public class MyJdbTable extends com.borland.dbswing.JdbTable {

public boolean isCellEditable(int row, int column) {

return true; // Or false. you have to place to code here

}

}

That is what I thought. But that will not set the Cell editable.
 

Re:Set a cell editable...

Mauricio Meza wrote:
Quote
Thks guys for your answers .... but overriding the isCellEditable Method,
I just get a boolean value
and I want a set the editable propertie in a specific cell, not in the
entire jdbTable

Yep, that is what I thought you wanted. Look at what I sent originally. That
will work for you.
Quote
... and pnichols .. Is the TableCellEditor an interface, isn't it? ...I
get
a error when I try to instantiate it..
Yes, you would need to create a class that implemented this interface. You
should find all of the this in Help files under Java Reference. Just search
for TableCellEditor and it will give you the methods.