 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Nikola Vidoviæ Guest
|
Posted: Wed Sep 06, 2006 1:29 am Post subject: jdbtable question |
|
|
Hi guys.
This is an interesting problem that is bothering me. I connect to the
database and retrieve my data in queryDataSet1. I am setting custom 4 last
columns (the only that are bigdecimal) in queryDataSet1 and setting
displayMask:
(..) column1.setColumnName("Iznos");
column1.setCaption("Iznos");
column1.setDataType(com.borland.dx.dataset.Variant.BIGDECIMAL);
column1.setDisplayMask("#,###.00");
column1.setPrecision(1 ;
column1.setScale(2);
column1.setTableName("dokum_zag");
column1.setServerColumnName("fakizn");
column1.setSqlType(2); (..)
Everything is fine when jdbTable is first shown. But then I wrote an
HeaderListener which listen to mouse events on the header of jdbTable. I
want to get the selected column and paint it yellow, while all others are
white:
class HeaderListener extends MouseAdapter {
private Dokumenti_Frame adaptee;
JTableHeader header;
HeaderListener(JTableHeader header) {
this.header = header;
}
public void mouseReleased(MouseEvent e) {
TableColumn tc;
int col = header.columnAtPoint(e.getPoint());
DefaultTableCellRenderer t = new DefaultTableCellRenderer();
DefaultTableCellRenderer t1 = new DefaultTableCellRenderer();
TableColumnModel cm =
prodaja.Dokumenti_Frame.jdbTable1.getColumnModel();
for (int i = 0; i < cm.getColumnCount(); i++) {
tc = cm.getColumn(i);
tc.setCellRenderer(t1);
t1.setBackground(Color.WHITE); }
TableColumn tc1 = cm.getColumn(col); tc1.setCellRenderer(t);
t.setBackground(new Color(250, 247, 177));
}
}
It works fine. Unselected columns are white and the selected one is
yellow, but the displayMask is ignored. The values are left oriented like
they are strings and the mask is wrong. What am I dooing wrong???
Thanks,
Zvonko |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|