BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

jdbtable question

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> JBuilder DB Swing
View previous topic :: View next topic  
Author Message
Nikola Vidoviæ
Guest





PostPosted: Wed Sep 06, 2006 1:29 am    Post subject: jdbtable question Reply with quote



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(1Cool;
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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> JBuilder DB Swing All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.