Greetings all the master java programming language, please guidance. I find it difficult to display the number format from database to JTable with a money separator. I've been googling but all the ways that I get failed.
Thank you,
Best Regards.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Greetings all the master java programming language, please guidance. I find it difficult to display the number format from database to JTable with a money separator. I've been googling but all the ways that I get failed.
Thank you,
Best Regards.
I have no idea what you're trying to do, but it sounds like a renderer problem.
How to Use Tables (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)
i want to Render Cell to locale Germany, so I can display the numeric data from database to JTable column with format money.
because the money format separator German same as my country Indonesia,
Example Money Format : Rp. 1.000.000,00
Yup, you need a tableCellRenderer.
can give me sample code, because I am not too understand jTable column render ^_^.
Uhm, Ive posted a link to the tutorial in my previous post. There is example code.
this my code :
public final class TransaksiMhs extends javax.swing.JInternalFrame { DefaultTableModel tabelModel = new DefaultTableModel(); static class DecimalFormatRenderer extends DefaultTableCellRenderer { private static final DecimalFormat formatter = new DecimalFormat( "#.00" );} /*Jika ingin menggunakan horizontal jScrollpane setAutoRezieMode tabel harus di off*/ /** Creates new form TransaksiMhs */ public TransaksiMhs() { initComponents(); tabelBiaya.setModel(tabelModel); tabelModel.addColumn("NO.TRANS"); tabelModel.addColumn("NAMA"); tabelModel.addColumn("BIAYA"); tabelModel.addColumn("HARGA"); tabelModel.addColumn("JUMLAH"); tabelModel.addColumn("TOTAL"); tabelBiaya.getColumnModel().getColumn(5).setCellRenderer(new DecimalFormatRenderer());
but nothing happen to jTable Column, what wrong with my code?