List of usage examples for javax.swing.table JTableHeader addMouseMotionListener
public synchronized void addMouseMotionListener(MouseMotionListener l)
From source file:Main.java
public static void main(String[] argv) throws Exception { int rows = 10; int cols = 5; JTable table = new JTable(rows, cols); JTableHeader header = table.getTableHeader(); ColumnHeaderToolTips tips = new ColumnHeaderToolTips(); for (int c = 0; c < table.getColumnCount(); c++) { TableColumn col = table.getColumnModel().getColumn(c); tips.setToolTip(col, "Col " + c); }/*from w w w. j av a 2s . com*/ header.addMouseMotionListener(tips); }
From source file:SortableTable.java
/** * Standard constructor - builds a table for the specified model. * * @param model the data./*from w w w .j a va 2s.c o m*/ */ public SortableTable(final SortableTableModel model) { super(model); final SortButtonRenderer renderer = new SortButtonRenderer(); final TableColumnModel cm = getColumnModel(); for (int i = 0; i < cm.getColumnCount(); i++) { cm.getColumn(i).setHeaderRenderer(renderer); } final JTableHeader header = getTableHeader(); this.headerListener = new SortableTableHeaderListener(model, renderer); header.addMouseListener(this.headerListener); header.addMouseMotionListener(this.headerListener); model.sortByColumn(0, true); }
From source file:org.yccheok.jstock.gui.IndicatorScannerJPanel.java
private void initTableHeaderToolTips() { JTableHeader header = jTable1.getTableHeader(); ColumnHeaderToolTips tips = new ColumnHeaderToolTips(); header.addMouseMotionListener(tips); }
From source file:org.yccheok.jstock.gui.JStock.java
private void initTableHeaderToolTips() { JTableHeader header = jTable1.getTableHeader(); ColumnHeaderToolTips tips = new ColumnHeaderToolTips(); tips.setToolTip(jTable1.getColumn(GUIBundle.getString("MainFrame_FallBelow")), java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/gui") .getString("MainFrame_AlertUserWhenLastPriceFallBelowOrEqualToSpecifiedValue")); tips.setToolTip(jTable1.getColumn(GUIBundle.getString("MainFrame_RiseAbove")), java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/gui") .getString("MainFrame_AlertUserWhenLastPriceFallAboveOrEqualToSpecifiedValue")); header.addMouseMotionListener(tips); }
From source file:pipeline.GUI_utils.JXTablePerColumnFiltering.java
public JXTablePerColumnFiltering(TableModel model) { super(model); this.model = (BeanTableModel<?>) model; // Create the 1-row filtering Table nColumns = model.getColumnCount();//w w w . j a v a2s. co m // DependencyEngine e = new DependencyEngine(new BasicEngineProvider()); for (int row = 0; row < model.getRowCount(); row++) { for (int i = 0; i < nColumns; i++) { if (getColumnName(i).contains("userCell")) { // this is a column with cells that can contain formulas in addition to computed values } else { } } } filteringModel = new DefaultTableModel(1, nColumns); initializeFilterModel(); filteringTable = new JXTableBetterFocus(filteringModel); filteringTable.setTableHeader(null); for (int i = 0; i < nColumns; i++) { TableColumn fColumn = filteringTable.getColumn(i); MultiRenderer multiRenderer = getMultiRenderer(); fColumn.setCellRenderer(multiRenderer); fColumn.setCellEditor(multiRenderer); fColumn.setWidth(getColumn(i).getWidth()); } this.setRowFilter(filter); JTableHeader header = this.getTableHeader(); if (tips == null) { tips = new ColumnHeaderToolTips(); } header.addMouseMotionListener(tips); }