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


Java JTable.columnAtPoint方法代碼示例

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


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

示例1: maybeShowPopup

import javax.swing.JTable; //導入方法依賴的package包/類
private void maybeShowPopup(MouseEvent e) {
            if (e.isPopupTrigger()) {
                JTable source = (JTable)(e.getSource());

                if ( ! source.isEnabled () ) return;

                _inputTablePopupRow = 
                        source.rowAtPoint(new Point (e.getX(), e.getY()));
                _inputTablePopupColumn = 
                        source.columnAtPoint(new Point (e.getX(), e.getY()));
                // Make sure the row where click occurred is selected.
                if (_inputTablePopupRow != -1) {
                    source.setRowSelectionInterval (_inputTablePopupRow,
                                                    _inputTablePopupRow);
                }
//                 if  ( _inputTablePopupColumn != Criteria_COLUMN )
//                 {
//                     // return without showing popup
//                     return;
//                 }

                _inputTablePopup.show(e.getComponent(), e.getX(), e.getY());
            }
        }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:QueryBuilderInputTable.java

示例2: isCellEditable

import javax.swing.JTable; //導入方法依賴的package包/類
@Override
public boolean isCellEditable(EventObject anEvent) {
    if (anEvent.getSource() instanceof JTable) {
        JTable table = (JTable) anEvent.getSource();
        if (anEvent instanceof MouseEvent) {
            MouseEvent event = (MouseEvent) anEvent;
            Point p = event.getPoint();
            int row = table.rowAtPoint(p);
            int col = table.columnAtPoint(p);
            Rectangle rect = table.getCellRect(row, col, true);
            p.translate(-rect.x, -rect.y);
            System.out.println("isCellEditable("+anEvent+")");
            System.out.println("Point "+p+"in rectangle "+rect);
            if (p.x > rect.width - 24) {
                // last 24 points not editable
                return false;
            }
        }
    }
    return true;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:TableRendererTest.java

示例3: RTable

import javax.swing.JTable; //導入方法依賴的package包/類
public RTable(Component source, JSONOMapConfig omapConfig, Point point, IJSONRecorder recorder) {
    super(source, omapConfig, point, recorder);
    JTable table = (JTable) source;
    if (table.isEditing()) {
        column = table.getEditingColumn();
        row = table.getEditingRow();
    } else {
        if (point != null) {
            row = table.rowAtPoint(point);
            column = table.columnAtPoint(point);
        } else {
            row = table.getSelectedRow();
            column = table.getSelectedColumn();
        }
    }
    if (row == -1 || column == -1) {
        row = column = -1;
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:20,代碼來源:RTable.java

示例4: mouseClicked

import javax.swing.JTable; //導入方法依賴的package包/類
@Override
public void mouseClicked(MouseEvent e) {
    JTable table = (JTable) e.getSource();
    Point pt = e.getPoint();
    int ccol = table.columnAtPoint(pt);
    int crow = table.rowAtPoint(pt);
    Object value = table.getValueAt(crow, ccol);
    if (value instanceof URL) {
        URL url = (URL) value;
        Desktop desktop = null;
        try {
            if (Desktop.isDesktopSupported()) {
                desktop = Desktop.getDesktop();
            }
        } catch (Exception ex) {
            throw new IllegalStateException(ex);
        }
        if (desktop != null) {
            try {
                desktop.browse(url.toURI());
            } catch (Exception exc) {
                // browsing failed; just don't do anything
            }
        }
    }
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:27,代碼來源:LibrariesTable.java

示例5: mouseClicked

import javax.swing.JTable; //導入方法依賴的package包/類
@Override
public void mouseClicked(MouseEvent e) {
    JTable table = (JTable) e.getSource();
    Point pt = e.getPoint();
    int ccol = table.columnAtPoint(pt);
    int crow = table.rowAtPoint(pt);
    Object value = table.getValueAt(crow, ccol);
    if (value instanceof URL) {
        URL url = (URL) value;
        try {
            if (Desktop.isDesktopSupported()) {
                Desktop.getDesktop().browse(url.toURI());
            }
        } catch (Exception ex) {
            throw new IllegalStateException(ex);
        }
    }
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:19,代碼來源:ContributorsTable.java

示例6: maybeShowPopup

import javax.swing.JTable; //導入方法依賴的package包/類
private void maybeShowPopup(MouseEvent e) {
    if (e.isPopupTrigger()) {
        JTable source = (JTable)(e.getSource());
        int row = source.rowAtPoint(e.getPoint());
        int column = source.columnAtPoint(e.getPoint());
        // Make sure the row where click occurred is selected.
        if (row != -1) {
            source.setRowSelectionInterval (row, row);
        }
        resultTablePopup.show(e.getComponent(), e.getX(), e.getY());
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:QueryBuilderResultTable.java

示例7: mouseMoved

import javax.swing.JTable; //導入方法依賴的package包/類
@Override
public void mouseMoved(MouseEvent e) {
    JTable table = (JTable) e.getSource();
    Point pt = e.getPoint();
    int prev_row = this.row;
    int prev_col = this.col;
    this.row = table.rowAtPoint(pt);
    this.col = table.columnAtPoint(pt);
    if (this.row != prev_row || this.col != prev_col) {
        Rectangle r = table.getCellRect(this.row, this.col, false);
        r = r.union(table.getCellRect(prev_row, prev_col, false));
        table.repaint(r);
    }
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:15,代碼來源:LibrariesTable.java

示例8: mouseDragged

import javax.swing.JTable; //導入方法依賴的package包/類
@Override
public void mouseDragged(MouseEvent e) {
    if (e.isAltDown() && startLocation != null) {
        isInDragOperation = true;
        JTable t = (JTable) e.getSource();
        int selRow = t.rowAtPoint(e.getPoint());
        int selColumn = t.columnAtPoint(e.getPoint());
        if (selRow != -1 && selColumn != -1) {
            rowsRColumns.add(new Integer[]{selRow, selColumn});
        }
    } else {
        isInDragOperation = false;
    }
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:15,代碼來源:TableCellDrag.java


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