public void mousePressed(MouseEvent e) {
   int col = header.columnAtPoint(e.getPoint());
   int sortCol = header.getTable().convertColumnIndexToModel(col);
   renderer.setPressedColumn(col);
   renderer.setSelectedColumn(col);
   header.repaint();
   if (header.getTable().isEditing()) {
     header.getTable().getCellEditor().stopCellEditing();
   }
   boolean isAscent;
   if (SortButtonRenderer.DOWN == renderer.getState(col)) {
     isAscent = true;
   } else {
     isAscent = false;
   }
   ((SortableTableModel) header.getTable().getModel()).sortByColumn(sortCol, isAscent);
 }
Esempio n. 2
0
  public void mousePressed(MouseEvent e) {
    int col = header.columnAtPoint(e.getPoint());

    renderer.setPressedColumn(col);
    renderer.setSelectedColumn(col);

    if (col == column) {
      this.isAscent = !this.isAscent;
    } else {
      this.column = col;
      this.isAscent = true;
    }

    this.model.sortByColumn(col, this.isAscent);

    this.header.getTable().updateUI();
    header.repaint();
  }