1 27 28 package swingwtx.swing.table; 29 30 import swingwt.awt.Point; 31 import swingwtx.swing.JTable; 32 33 public class JTableHeader extends swingwtx.swing.JComponent { 34 35 protected JTable table = null; 36 protected TableColumn resizingColumn = null; 37 38 public JTableHeader(JTable table) { this.table = table; } 39 40 public TableColumnModel getColumnModel() { return table.getColumnModel(); } 41 public void setColumnModel(TableColumnModel t) { table.setColumnModel(t); } 42 public boolean isReorderingAllowed() { return false; } 43 public void setReorderingAllowed(boolean b) {} 44 public JTable getTable() { return table; } 45 public int columnAtPoint(Point point) { 46 int x = point.x; 47 if (!getComponentOrientation().isLeftToRight()) { 48 if (table != null && table.getAutoResizeMode() != swingwtx.swing.JTable.AUTO_RESIZE_OFF) { 49 x = table.getWidth() - x; 50 } 51 else x = super.getWidth() - x; 52 } 53 54 return getColumnModel().getColumnIndexAtX(x); 55 } 56 public TableColumn getResizingColumn() { return resizingColumn; } 57 public void setResizingColumn(TableColumn resizingColumn) { this.resizingColumn = resizingColumn; } 58 } 59 | Popular Tags |