Last active
August 29, 2015 14:04
-
-
Save CeramicTitan/15344b447d5b17996d48 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JPanel panel_1 = new JPanel(); | |
panel_1.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Student Ranks", TitledBorder.LEADING, TitledBorder.TOP, null, null)); | |
panel_1.setBounds(6, 0, 534, 421); | |
frame.getContentPane().add(panel_1); | |
panel_1.setLayout(null); | |
String[] columnNames = {"Names","Level"}; | |
Object[][] data = utils.populateTable(); | |
JScrollPane scrollPane = new JScrollPane(); | |
scrollPane.setBounds(6, 18, 522, 396); | |
panel_1.add(scrollPane); | |
table = new JTable(data, columnNames); | |
TableRowSorter sorter = new TableRowSorter(table.getModel()); | |
sorter.setComparator(1, new CustomComparator()); | |
table.setRowSorter(sorter); | |
scrollPane.setViewportView(table); | |
table.setFillsViewportHeight(true); | |
} | |
public class CustomComparator implements Comparator<String>{ | |
String[] levels = {"Black", "Brown","Green","Blue","Yellow","White"}; | |
@Override | |
public int compare(String o1, String o2) { | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment