0

I am trying to arrange JTable rows with one of the its column value.. it needs to the highest first and lowest last.. Please Help

I tried this code:

    JTable reporttable = new JTable();
    reporttable.setFillsViewportHeight(true);
    reporttable.setCellSelectionEnabled(true);
    reporttable.setSurrendersFocusOnKeystroke(true);
    reporttable.setColumnSelectionAllowed(true);
    reporttable.setBackground(new Color(255, 255, 255));
    reporttable.getTableHeader().setFont(new Font("Times New Roman", Font.PLAIN, 10));

     JScrollPane reportpane = new JScrollPane( reporttable);
     reportpane.setViewportBorder(null);

    TableRowSorter<TableModel> reportsorter = new TableRowSorter<TableModel>(allmodel);
    reporttable.setRowSorter(reportsorter);

     reportpanel.add(reportpane);
     reporttable.setModel(allmodel);
     reportpane.setBounds(20, 347, 817, 74);
Jad Chahine
  • 6,849
  • 8
  • 37
  • 59
  • `reportpane.setBounds(20, 347, 817, 74);` Java GUIs have to work on different OS', screen size, screen resolution etc. using different PLAFs in different locales. As such, they are not conducive to pixel perfect layout. Instead use layout managers, or [combinations of them](http://stackoverflow.com/a/5630271/418556) along with layout padding and borders for [white space](http://stackoverflow.com/a/17874718/418556). – Andrew Thompson Nov 09 '15 at 08:13
  • read Oracle tutorial How to use Tables, part about sorting and filtering, without an SSCCE / MCVE too hard to say anything, voting to close too – mKorbel Nov 09 '15 at 08:40

0 Answers0