public void addMouseListenerToHeaderInTable(JTable table) { final TableSorter sorter = this; final JTable tableView = table; tableView.setColumnSelectionAllowed(false); MouseAdapter listMouseListener = new MouseAdapter() { public void mouseClicked(MouseEvent e) { TableColumnModel columnModel = tableView.getColumnModel(); int viewColumn = columnModel.getColumnIndexAtX(e.getX()); int column = tableView.convertColumnIndexToModel(viewColumn); if (e.getClickCount() == 1 && column != -1) { if (lastSortedColumn == column) ascending = !ascending; sorter.sortByColumn(column, ascending); lastSortedColumn = column; } } }; JTableHeader th = tableView.getTableHeader(); th.addMouseListener(listMouseListener); }
header.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) {
table.getTableHeader().addMouseListener(mouse);
table.getTableHeader().addMouseListener(new MyMouseAdapter(0, this)); checkContent(); collectVariables();
@Override public void addMouseListener(MouseListener l) { super.addMouseListener(l); treeTable.getTableHeader().addMouseListener(l); }
/** * We need to notice when the table header is changed so that we can move the mouse listener to the new header. * @param pEvent table header change event */ public void propertyChange(final PropertyChangeEvent pEvent) { ((JTableHeader)pEvent.getOldValue()).removeMouseListener(this); ((JTableHeader)pEvent.getNewValue()).addMouseListener(this); }
public void addMouseListenerToHeaderInTable(JTable table) { table.setColumnSelectionAllowed(false); JTableHeader th = table.getTableHeader(); th.addMouseListener(new TableSorterHeaderMouseAdapter(this, table)); } }
/** * Attaches listeners to the JTableHeader. */ protected void installListeners() { mouseInputListener=createMouseInputListener(); header.addMouseListener(mouseInputListener); header.addMouseMotionListener(mouseInputListener); }
/** * Adds mouse listener to the header for sorting and auto-sizing * of the columns. */ private void updateMouseListener() { JTableHeader jth = getTableHeader(); if (jth != null) { jth.removeMouseListener(headerMouseListener); // not to add it twice jth.addMouseListener(headerMouseListener); } }
public void addNotify() { super.addNotify(); if (getTableHeader() != null) { getTableHeader().addMouseListener(COLUMN_AUTO_RESIZER); } }
public void addMouseListenerToTableHeader() { setColumnSelectionAllowed(false); JTableHeader th = getTableHeader(); th.addMouseListener(new listMouseListener ()); }
public void addMouseListenerToTableHeader() { setColumnSelectionAllowed(false); JTableHeader th = getTableHeader(); th.addMouseListener(new listMouseListener ()); }
public RepositoryTable(OntologyRepository repository) { setModel(new RepositoryTableModel(repository)); setRowHeight(getRowHeight() + 4); setShowHorizontalLines(true); setGridColor(Color.LIGHT_GRAY); getColumnModel().getColumn(0).setPreferredWidth(100); getTableHeader().addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { sort(e); } } );}
public RepositoryTable(OntologyRepository repository) { setModel(new RepositoryTableModel(repository)); setRowHeight(getRowHeight() + 4); setShowHorizontalLines(true); setGridColor(Color.LIGHT_GRAY); getColumnModel().getColumn(0).setPreferredWidth(100); getTableHeader().addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { sort(e); } } );}
public RepositoryTable(OntologyRepository repository) { setModel(new RepositoryTableModel(repository)); setRowHeight(getRowHeight() + 4); setShowHorizontalLines(true); setGridColor(Color.LIGHT_GRAY); getColumnModel().getColumn(0).setPreferredWidth(100); getTableHeader().addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { sort(e); } } );}
public void setTableHeader(final JTableHeader _tableHeader){ if(getTableHeader()!=null) { getTableHeader().removeMouseListener(COLUMN_AUTO_RESIZER); } super.setTableHeader(_tableHeader); if(_tableHeader!=null && isShowing()) { _tableHeader.addMouseListener(COLUMN_AUTO_RESIZER); } }
public void setTableHeader(final JTableHeader _tableHeader) { if (getTableHeader() != null) { getTableHeader().removeMouseListener(COLUMN_AUTO_RESIZER); } super.setTableHeader(_tableHeader); if (_tableHeader != null && isShowing()) { _tableHeader.addMouseListener(COLUMN_AUTO_RESIZER); } }
public AOISortingDecorator(final AOITableModel tableModel, final JTableHeader tableHeader) { _tableModel = tableModel; _tableModel.addTableModelListener(new TableModelListener() { public void tableChanged(final TableModelEvent e) { initViewToModel(); fireTableChanged(e); } }); _tableHeader = tableHeader; _tableHeader.addMouseListener(new MouseHandler()); _tableHeader.setDefaultRenderer(new SortableHeaderRenderer(_tableHeader.getDefaultRenderer())); }
public CayenneTable() { super(); this.setRowHeight(25); this.setRowMargin(3); JTableHeader header = getTableHeader(); tableHeaderListener = new TableHeaderListener(header, renderer); header.addMouseListener(tableHeaderListener); setSelectionModel(new CayenneListSelectionModel()); }
private void init() { setColumnModel(new PropertiesTableColumnModel()); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); getTableHeader().setResizingAllowed(true); getTableHeader().setReorderingAllowed(false); popupMenu = new DriverPropertiesPopupMenu(this); addMouseListener(this); this.getTableHeader().addMouseListener(this); }