craftleft.gif (3002 bytes)QuickTable
Home | API | Tutorial | Download | Support | Contact topblack.gif (108 bytes)


QuickTable User Cp  |  Register  |  Members  |  Search  |  Help
    |- QuickTable Discussion Forums > CellEditor/Renderer Post New Topic   Post A Reply
CENTER A CHECKBOX printer friendly version
next newest post | next oldest post
Author Messages
Lex-Luthor
Private

Gender: Unspecified
Location:
Registered: Mar 2005
Status: Offline
Posts: 7

Click here to see the profile for Lex-Luthor Send email to Lex-Luthor Send private message to Lex-Luthor Find more posts by Lex-Luthor Edit or delete this message Reply w/Quote
Posted Friday, April 1, 2005 @ 10:24:08  

Hi.
I need to center a checkbox in a row.
My code:

....
....
try {
String[] campos = {"getCodigoUsuario","getDescripcionUsuario","getAutorizado"};
DBTable.refreshDataObject(caja.getUsuariosAutorizados(),campos);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
DBTable.getColumn(0).setHeaderValue("Usuario");
DBTable.getColumn(0).setPreferredWidth(100);
DBTable.getColumn(1).setHeaderValue("Descripción");
DBTable.getColumn(1).setPreferredWidth(425);
DBTable.getColumn(2).setHeaderValue("Autorizado");
DBTable.getColumn(2).setPreferredWidth(85);
Hashtable h = new Hashtable();
h.put(new Integer(1),new Boolean(true));
h.put(new Integer(0),new Boolean(false));
Column c = DBTable.getColumn(2);
DBTable.setCellComponent(c,Column.CHECKBOX_CELL,h);

Thanks.

Admin
Board Owner

Gender: Unspecified
Location:
Registered: Jul 2003
Status: Offline
Posts: 9

Click here to see the profile for Admin Send email to Admin Send private message to Admin Find more posts by Admin Edit or delete this message Reply w/Quote
Posted Sunday, April 3, 2005 @ 00:27:13  

Cell alignment can be controlled using the CellPropertiesModel class. Please refer the api help and CustomerOrderDemo sample for information.

If column 4 is checkbox column, the following code will align the checkbox to center.

Code:

class MyCellPropertiesModel extends CellPropertiesModel
{
public int getAlignment(int row, int col)
{
if( col== 4 )
return SwingConstants.CENTER;
else
return -1;

}
};

dBTable1.setCellPropertiesModel(new MyCellPropertiesModel());

Post New Topic   Post A Reply Jump to:
Contact Us | QuickTable - A Java DBGrid | Privacy Policy All times are GMT -5 Hours.
Welcome to QuickTable Forums, Guest!  
Login
Username :
Password :
In order to fully utilize the abilities of this board, you are required to register as a member. Registration is free, and allows you to do lots of things including turning on or off certain features of this board. Register now!
Powered by CuteCast v2.0 BETA 2
Copyright © 2001-2003 ArtsCore Studios