當前位置: 首頁>>代碼示例>>Java>>正文


Java JTableHeader.getDraggedColumn方法代碼示例

本文整理匯總了Java中javax.swing.table.JTableHeader.getDraggedColumn方法的典型用法代碼示例。如果您正苦於以下問題:Java JTableHeader.getDraggedColumn方法的具體用法?Java JTableHeader.getDraggedColumn怎麽用?Java JTableHeader.getDraggedColumn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.table.JTableHeader的用法示例。


在下文中一共展示了JTableHeader.getDraggedColumn方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: repaintTimeline

import javax.swing.table.JTableHeader; //導入方法依賴的package包/類
private void repaintTimeline() {
    JTableHeader header = threadsTable.getTableHeader();
    TableColumn draggedColumn = header.getDraggedColumn();
    if (draggedColumn != null && draggedColumn.getModelIndex() == 2) {
        header.repaint();
    } else {
        int _column = threadsTable.convertColumnIndexToView(2);
        header.repaint(header.getHeaderRect(_column));
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:ThreadsPanel.java

示例2: getTableCellRendererComponent

import javax.swing.table.JTableHeader; //導入方法依賴的package包/類
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
		int row, int column) {
	if (table != null) {
		JTableHeader header = table.getTableHeader();
		if (header != null) {
			setFont(header.getFont());
		}
	}

	this.rollOver = column == TableHeaderUI.this.highlightedColumn;
	if (header != null) {
		curCol = column;
		this.isLeftmost = column == 0;
		this.isRightmost = column == header.getColumnModel().getColumnCount() - 1;
	}

	if (header != null && header.getDraggedColumn() != null) {
		this.isPressed = viewIndexForColumn(header.getDraggedColumn()) == column
				|| column == TableHeaderUI.this.pressedColumn;
	} else {
		this.isPressed = false;
	}
	setText(value == null ? "" : value.toString());
	setHorizontalAlignment(SwingConstants.LEFT);
	setHorizontalTextPosition(SwingConstants.LEADING);
	setBorder(HEADER_BORDER);
	return this;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:30,代碼來源:TableHeaderUI.java

示例3: paintCells

import javax.swing.table.JTableHeader; //導入方法依賴的package包/類
/**
    * (copy & paste from BasicTableUI)
    */
   private void paintCells(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);
               if( isFoldingRow( row ) ) {
                   //paint the cell across the whole table
                   cellRect.x = 0;
                   cellRect.width = table.getColumnModel().getTotalColumnWidth()-columnMargin;
                   paintCell( g, cellRect, row, 0 );
               } else {
                   for(int column = cMin; column <= cMax; column++) {
                       aColumn = cm.getColumn(column);
                       columnWidth = aColumn.getWidth();
                       cellRect.width = columnWidth - columnMargin;
                       if (aColumn != draggedColumn) {
                           paintCell(g, cellRect, row, column);
                       }
                       cellRect.x += columnWidth;
                   }
               }
    }
} else {
    for(int row = rMin; row <= rMax; row++) {
               cellRect = table.getCellRect(row, cMin, false);
               if( isFoldingRow( row ) ) {
                   //paint the cell across the whole table
                   cellRect.x = 0;
                   cellRect.width = table.getColumnModel().getTotalColumnWidth()-columnMargin;
                   paintCell( g, cellRect, row, 0 );
               } else {
                   aColumn = cm.getColumn(cMin);
                   if (aColumn != draggedColumn) {
                       columnWidth = aColumn.getWidth();
                       cellRect.width = columnWidth - columnMargin;
                       paintCell(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(g, cellRect, row, column);
                       }
                   }
               }
    }
}

       // Paint the dragged column if we are dragging.
       if (draggedColumn != null) {
    paintDraggedArea(g, rMin, rMax, draggedColumn, header.getDraggedDistance());
}

// Remove any renderers that may be left in the rendererPane.
rendererPane.removeAll();
   }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:70,代碼來源:TaskListTableUI.java

示例4: paintCells

import javax.swing.table.JTableHeader; //導入方法依賴的package包/類
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();
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:54,代碼來源:SynthTableUI.java


注:本文中的javax.swing.table.JTableHeader.getDraggedColumn方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。