本文整理汇总了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());
}
}
示例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;
}
示例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;
}
}
示例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
}
}
}
}
示例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);
}
}
}
示例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());
}
}
示例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);
}
}
示例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;
}
}