Colour Specific Cell within Table
Created a basic table, fields have been filled but i want to colour in a specific cell how would i do this? what will i also need to import
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
Vector<String> rowOne = new Vector<String>();
rowOne.addElement("R1-C1");
rowOne.addElement("R1-C2");
rowOne.addElement("R1-C3");
rowOne.addElement("R1-C4");
Vector<String> rowTwo = new Vector<String>();
rowTwo.addElement("R2-C1");
rowTwo.addElement("R2-C2");
rowTwo.addElement("R2-C3");
rowTwo.addElement("R2-C4");
Vector<String> rowThree = new Vector<String>();
rowThree.addElement("R3-C1");
rowThree.addElement("R3-C2");
rowThree.addElement("R3-C3");
rowThree.addElement("R3-C4");
Vector<String> rowFour = new Vector<String>();
rowFour.addElement("R4-C1");
rowFour.addElement("R4-C2");
rowFour.addElement("R4-C3");
rowFour.addElement("R4-C4");
Vector<Vector> rowData = new Vector<Vector>();
rowData.addElement(rowOne);
rowData.addElement(rowTwo);
rowData.addElement(rowThree);
rowData.addElement(rowFour);
Vector<String> columnNames = new Vector<String>();
columnNames.addElement("Column One");
columnNames.addElement("Column Two");
columnNames.addElement("Column Three");
columnNames.addElement("Column Four");
JTable table = new JTable(rowData, columnNames);
JScrollPane scrollPane = new JScrollPane(table);
frame.add(scrollPane, BorderLayout.CENTER);
frame.setSize(300, 150);
frame.setVisible(true);