1. Can we paint a JTable cell partially? stackoverflow.comIs it possible to paint a JTable cell alone partially?Like 40% of it is green remaining is red? |
2. JTable paint the cells coderanch.comimport java.awt.*; import javax.swing.*; import javax.swing.table.*; public class TableHighlights { private JTable getTable() { JTable table = new JTable(new CustomModel()) { public Class getColumnClass(int column) { return ((CustomModel)getModel()).data[0][column].getClass(); } }; table.setDefaultRenderer(String.class, new GPARenderer()); return table; } public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setContentPane(new JScrollPane(new TableHighlights().getTable())); f.setSize(400,400); f.setLocation(200,200); f.setVisible(true); } } class CustomModel extends AbstractTableModel { ... |