Jtable column alignment

HiI have a double object in a jtable column and I want it to be aligned to the right.How can I do that?ThanksBenbak
[150 byte] By [Benbaka] at [2007-10-3 5:15:02]
# 1
Check this post out: http://forum.java.sun.com/thread.jspa?threadID=303905&messageID=1208792
MatthewJMurraya at 2007-7-14 23:21:37 > top of Java-index,Desktop,Core GUI APIs...
# 2

Thanks for the reply,

the problem is that I have already a cell renderer for that column that allows me to display it as currency. here is the code:

public class CurrencyCellRenderer extends DefaultTableCellRenderer {

private Format format;

public CurrencyCellRenderer() {

this.format = NumberFormat.getCurrencyInstance();

}

public void setValue(Object value) {

setText(format.format(value));

}

}

so how can I make it align ot the right.

Thanks

benbak

Benbaka at 2007-7-14 23:21:37 > top of Java-index,Desktop,Core GUI APIs...
# 3

Use the "Code" formatting tags when posting code so the code is readable.

> so how can I make it align ot the right.

Check out the posting from above and incorporate the concepts of that renderer into your renderer. (ie. the DefaultTableCellRenderer extends JLabel so you just set the alignment in your constructor).

camickra at 2007-7-14 23:21:37 > top of Java-index,Desktop,Core GUI APIs...
# 4
Got it. Thanks.Benbak
Benbaka at 2007-7-14 23:21:37 > top of Java-index,Desktop,Core GUI APIs...