use of javax.swing.table.JTableHeader in project frostwire by frostwire.
the class AbstractTableMediator method handleHeaderColumnReleased.
/**
* Tell the table something is not pressed.
*/
public void handleHeaderColumnReleased(Point p) {
TABLE.setPressedColumnIndex(-1);
JTableHeader th = TABLE.getTableHeader();
int col = th.columnAtPoint(p);
if (col != -1)
// force the table to redraw the column header
th.repaint(th.getHeaderRect(col));
}
use of javax.swing.table.JTableHeader in project jgnash by ccavanaugh.
the class BudgetPeriodPanel method layoutMainPanel.
private void layoutMainPanel() {
FormLayout layout = new FormLayout("d:g", "d");
DefaultFormBuilder builder = new DefaultFormBuilder(layout, this);
setLayout(layout);
table = new AccountPeriodResultsTable(model);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
table.setFocusable(false);
table.setCellSelectionEnabled(false);
JTableHeader header = new JTableHeader(table.getColumnModel());
header.setReorderingAllowed(false);
header.setResizingAllowed(false);
header.setTable(table);
buildHeader(header);
buildFooter();
JTableUtils.packTables(table, footerTable);
builder.add(table, CC.xy(1, 1));
setBorder(ShadowBorder.getCompondShadowBorder());
ToolTipManager.sharedInstance().unregisterComponent(table);
ToolTipManager.sharedInstance().unregisterComponent(header);
}
use of javax.swing.table.JTableHeader in project jgnash by ccavanaugh.
the class AccountRowHeaderPanel method getTableHeader.
JPanel getTableHeader() {
JTableHeader header = table.getTableHeader();
header.setReorderingAllowed(false);
header.setResizingAllowed(false);
JPanel panel = new JXTitledPanel(" ", header);
panel.setBorder(ShadowBorder.getCompondShadowBorder());
return panel;
}
use of javax.swing.table.JTableHeader in project jdk8u_jdk by JetBrains.
the class TableSorter method addMouseListenerToHeaderInTable.
// Add a mouse listener to the Table to trigger a table sort
// when a column heading is clicked in the JTable.
public void addMouseListenerToHeaderInTable(JTable table) {
tableView = table;
columnModel = tableView.getColumnModel();
JTableHeader th = tableView.getTableHeader();
th.addMouseListener(this);
}
use of javax.swing.table.JTableHeader in project jdk8u_jdk by JetBrains.
the class SynthTableUI method paintCells.
private void paintCells(SynthContext context, Graphics g, int rMin, int rMax, int cMin, int cMax) {
JTableHeader header = table.getTableHeader();
TableColumn draggedColumn = (header == null) ? null : header.getDraggedColumn();
TableColumnModel cm = table.getColumnModel();
int columnMargin = cm.getColumnMargin();
Rectangle cellRect;
TableColumn aColumn;
int columnWidth;
if (table.getComponentOrientation().isLeftToRight()) {
for (int row = rMin; row <= rMax; row++) {
cellRect = table.getCellRect(row, cMin, false);
for (int column = cMin; column <= cMax; column++) {
aColumn = cm.getColumn(column);
columnWidth = aColumn.getWidth();
cellRect.width = columnWidth - columnMargin;
if (aColumn != draggedColumn) {
paintCell(context, g, cellRect, row, column);
}
cellRect.x += columnWidth;
}
}
} else {
for (int row = rMin; row <= rMax; row++) {
cellRect = table.getCellRect(row, cMin, false);
aColumn = cm.getColumn(cMin);
if (aColumn != draggedColumn) {
columnWidth = aColumn.getWidth();
cellRect.width = columnWidth - columnMargin;
paintCell(context, g, cellRect, row, cMin);
}
for (int column = cMin + 1; column <= cMax; column++) {
aColumn = cm.getColumn(column);
columnWidth = aColumn.getWidth();
cellRect.width = columnWidth - columnMargin;
cellRect.x -= columnWidth;
if (aColumn != draggedColumn) {
paintCell(context, g, cellRect, row, column);
}
}
}
}
// Paint the dragged column if we are dragging.
if (draggedColumn != null) {
paintDraggedArea(context, g, rMin, rMax, draggedColumn, header.getDraggedDistance());
}
// Remove any renderers that may be left in the rendererPane.
rendererPane.removeAll();
}
Aggregations