HI BJ,

I am not sure I got you right. So are you saying that you no longer have an issue here? By specifying the returned Object of your table model to be a Vector? Of which type it used to be?
Thanks and cheers,

christian

On Nov 19, 2009, at 9:29 PM, BJ Tenney wrote:

When I change my getValueAt(int row, int col) method to return a Vector, it works correctly.

BJ Tenney
Tomax Corporation

----- Original Message -----
From: "BJ Tenney" <[email protected]>
To: [email protected]
Sent: Thursday, November 19, 2009 1:12:57 PM GMT -07:00 US/Canada Mountain
Subject: [ULC-developer] TableCellRenderer not recognizing Anything


version: 6.0.3

I am trying to write a TableCellRenderer which renders a com.ulcjava.base.shared.internal.Anything

Here is my code:


public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
JLabel rendererLabel = new JLabel();
rendererLabel.setOpaque(true);
if (value != null){
Vector anything = (Vector) value;
rendererLabel.setText(anything.get(0).toString());
rendererLabel.setForeground(getColor(anything.get(1).toString()));
rendererLabel.setBackground(getColor(anything.get(2).toString()));
rendererLabel .setHorizontalAlignment(Integer.parseInt(anything.get(3).toString()));
rendererLabel.setToolTipText(anything.get(4).toString());
}
else {
rendererLabel.setText("-");
rendererLabel.setToolTipText("");
rendererLabel.setHorizontalAlignment(JLabel.CENTER);
}

return rendererLabel;
}


I originally tried to cast the value to Anything but I received a ClassCastException saying that value is a Vector.
Now, I am getting this error:

Exception in thread "AWT-EventQueue-3" java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0
at java.util.Vector.get(Unknown Source)
at com .tomax .ta .ulc .timecards .ui .TimeRollupCellRenderer .getTableCellRendererComponent(TimeRollupCellRenderer.java:58)


I have debugged through my method public Object getValueAt(int row, int col) on the server to make sure it is not returning an empty Vector. Any help as to why rendering is not working would be greatly appreciated.


Thanks,
BJ Tenney
Tomax Corporation

_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer

_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer

Reply via email to