0

i need to make this table with all format and component = to another table

 JTable table = new JTable(model) {
        @Override
        public Component prepareRenderer(TableCellRenderer renderer,
                int row, int col) {

            Component c = super.prepareRenderer(renderer, row, col);
            if (col == 2) {

                String SeeMe = (String) jTable1.getValueAt(row, 2);

                if (SeeMe.equals("0")) {
                    c.setBackground(Color.white);
                    c.setForeground(Color.red);
                }

            } else {
                c.setForeground(Color.black);
                c.setBackground(Color.white);
            }
            return c;
        }

    };

this table have a component and this what i need to applay it to my second table

camickr
  • 321,443
  • 19
  • 166
  • 288
  • 1
    In your question yesterday: https://stackoverflow.com/questions/62271937/color-a-distinct-field-in-a-jtable-while-data-is-inserted-from-sql the suggestions was to use a custom renderer. If you use a renderer then it can be shared by any table. – camickr Jun 10 '20 at 15:26
  • This question was also asked under a second user id: https://stackoverflow.com/questions/62334812/set-defaultrenderer-for-jtable-from-another-table – camickr Jun 12 '20 at 03:13

0 Answers0