tags:

views:

140

answers:

0

I try to make the entire row in a JXTreeTable to become bold.

    final TableCellRenderer doubleOldTableCellRenderer = this.buyTreeTable.getDefaultRenderer(Double.class);
    final TableCellRenderer integerOldTableCellRenderer = this.buyTreeTable.getDefaultRenderer(Integer.class);
    final TableCellRenderer treeTableModelOldTableCellRenderer = this.buyTreeTable.getDefaultRenderer(TreeTableModel.class);
    // "treeTableModelOldTableCellRenderer = null"
    System.out.println("treeTableModelOldTableCellRenderer = " + treeTableModelOldTableCellRenderer);
    this.buyTreeTable.setDefaultRenderer(TreeTableModel.class, new DefaultTableCellRenderer() {

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
            Component c = treeTableModelOldTableCellRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            c.setFont(org.yccheok.jstock.gui.Utils.getBoldFont(c.getFont()));
            return c;
        }

    });
    this.buyTreeTable.setDefaultRenderer(Integer.class, new DefaultTableCellRenderer() {

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
            Component c = integerOldTableCellRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            c.setFont(org.yccheok.jstock.gui.Utils.getBoldFont(c.getFont()));
            return c;
        }

    });
    this.buyTreeTable.setDefaultRenderer(Double.class, new DefaultTableCellRenderer() {

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
            Component c = doubleOldTableCellRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            c.setFont(org.yccheok.jstock.gui.Utils.getBoldFont(c.getFont()));
            //System.out.println(c);
            //System.out.println(c.getFont());
            return c;
        }

    });

However, here is the effect I get :

alt text

May I know how I can make the folder name bold as well?

Thanks