本文整理了Java中javax.swing.JTree.getRowForLocation()
方法的一些代码示例,展示了JTree.getRowForLocation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.getRowForLocation()
方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:getRowForLocation
暂无
代码示例来源:origin: stackoverflow.com
// If you are interested in detecting either double-click events or when a user clicks on a node, regardless of whether or not it was selected, we recommend you do the following:
final JTree tree = ...;
MouseListener ml = new MouseAdapter() {
public void mousePressed(MouseEvent e) {
int selRow = tree.getRowForLocation(e.getX(), e.getY());
TreePath selPath = tree.getPathForLocation(e.getX(), e.getY());
if(selRow != -1) {
if(e.getClickCount() == 1) {
mySingleClick(selRow, selPath);
}
else if(e.getClickCount() == 2) {
myDoubleClick(selRow, selPath);
}
}
}
};
tree.addMouseListener(ml);
代码示例来源:origin: stackoverflow.com
final JTree tree = ...;
MouseListener ml = new MouseAdapter() {
public void mousePressed(MouseEvent e) {
int selRow = tree.getRowForLocation(e.getX(), e.getY());
TreePath selPath = tree.getPathForLocation(e.getX(), e.getY());
if(selRow != -1) {
if(e.getClickCount() == 1) {
mySingleClick(selRow, selPath);
}
else if(e.getClickCount() == 2) {
myDoubleClick(selRow, selPath);
}
}
}
};
tree.addMouseListener(ml);
代码示例来源:origin: ron190/jsql-injection
@Override
public void mousePressed(MouseEvent e) {
int selRow = ManagerDatabase.this.tree.getRowForLocation(e.getX(), e.getY());
TreePath selPath = ManagerDatabase.this.tree.getPathForLocation(e.getX(), e.getY());
if (selRow != -1 && e.getClickCount() == 2) {
if (ManagerDatabase.this.tree.isExpanded(selPath)) {
ManagerDatabase.this.tree.collapsePath(selPath);
} else {
ManagerDatabase.this.tree.expandPath(selPath);
}
}
}
代码示例来源:origin: abbot/abbot
@Override
public Integer call() {
return tree.getRowForLocation(where.x, where.y);
}
});
代码示例来源:origin: info.aduna.commons/aduna-commons-swing
public void mouseClicked(MouseEvent e) {
int row = tree.getRowForLocation(e.getX(), e.getY());
if (row >= 0) {
tree.expandRow(row);
}
}
});
代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-widgets-extra
DataTipCell getCell(JComponent component, Point point) {
JTree tree = (JTree) component;
int rowIndex = tree.getRowForLocation(point.x, point.y);
if (rowIndex < 0) {
return DataTipCell.NONE;
}
return new TreeDataTipCell(tree, rowIndex);
}
}
代码示例来源:origin: Waikato/weka-trunk
public void mousePressed(MouseEvent e) {
if(tree.getRowForLocation(e.getX(), e.getY()) != -1) {
if(e.getClickCount() == 1) {
popup.setVisible(false);
}
}
}
};
代码示例来源:origin: net.imagej/ij
public void mouseClicked(MouseEvent e) {
isDragging = false;
if (e.getClickCount()!=2)
return;
int selRow=pTree.getRowForLocation(e.getX(),e.getY());
if (selRow!=-1) toAction();
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
public void mousePressed(MouseEvent e) {
if(tree.getRowForLocation(e.getX(), e.getY()) != -1) {
if(e.getClickCount() == 1) {
popup.setVisible(false);
}
}
}
};
代码示例来源:origin: imagej/ImageJA
public void mouseClicked(MouseEvent e) {
isDragging = false;
if (e.getClickCount()!=2)
return;
int selRow=pTree.getRowForLocation(e.getX(),e.getY());
if (selRow!=-1) toAction();
}
代码示例来源:origin: org.nuiton/nuiton-widgets
DataTipCell getCell(JComponent component, Point point) {
JTree tree = (JTree) component;
int rowIndex = tree.getRowForLocation(point.x, point.y);
if (rowIndex < 0) {
return DataTipCell.NONE;
}
return new TreeDataTipCell(tree, rowIndex);
}
}
代码示例来源:origin: nu.zoom/eon2
private void maybeShowPopup(MouseEvent e) {
if (e.isPopupTrigger()) {
int row = tree.getRowForLocation(e.getX(), e.getY());
if (tree.getSelectionCount() < 2) {
tree.setSelectionRow(row);
}
popupMenu.show(e.getComponent(), e.getX(), e.getY());
}
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
protected void showPopup (MouseEvent e) {
int selRow = tree.getRowForLocation(e.getX(), e.getY());
if (!tree.isRowSelected(selRow)) {
tree.setSelectionRow(selRow);
}
}
};
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
protected void showPopup (MouseEvent e) {
int selRow = tree.getRowForLocation(e.getX(), e.getY());
if (!tree.isRowSelected(selRow)) {
tree.setSelectionRow(selRow);
}
}
};
代码示例来源:origin: org.boofcv/visualize
public void mousePressed(MouseEvent e) {
int selRow = tree.getRowForLocation(e.getX(), e.getY());
TreePath selPath = tree.getPathForLocation(e.getX(), e.getY());
if(e.getClickCount() == 2) {
handleClick((DefaultMutableTreeNode)tree.getLastSelectedPathComponent());
}
}
};
代码示例来源:origin: com.bbossgroups.rpc/bboss-rpc
public void mouseClicked(MouseEvent e) {
int selRow = jtree.getRowForLocation(e.getX(), e.getY());
TreePath selPath = jtree.getPathForLocation(e.getX(), e.getY());
if(selRow != -1)
selected_node=makeFQN(selPath.getPath());
}
};
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
public void mouseClicked(MouseEvent e) {
int selRow = jtree.getRowForLocation(e.getX(), e.getY());
TreePath selPath = jtree.getPathForLocation(e.getX(), e.getY());
if(selRow != -1)
selected_node=makeFQN(selPath.getPath());
}
};
代码示例来源:origin: gurkenlabs/litiengine
@Override
public void mouseClicked(MouseEvent e) {
int selRow = tree.getRowForLocation(e.getX(), e.getY());
if (selRow != -1 && e.getClickCount() == 2) {
EditorScreen.instance().getMapComponent().centerCameraOnFocus();
}
}
};
代码示例来源:origin: net.imagej/ij
public void mouseDragged(MouseEvent e)
{
int selRow = pTree.getRowForLocation(e.getX(), e.getY());
if(selRow!=-1)
{
if(((DefaultMutableTreeNode)pTree.getLastSelectedPathComponent()).isLeaf()) return;
pFrame.setCursor(new Cursor(Cursor.MOVE_CURSOR));
isDragging = true;
}
}
});
代码示例来源:origin: abbot/abbot
public Rectangle call() {
int row = tree.getRowForLocation(where.x, where.y);
if (tree.getLeadSelectionRow() != row
|| tree.getSelectionCount() != 1) {
// NOTE: the row bounds *do not* include the expansion handle
return tree.getRowBounds(row);
}
else {
return null;
}
}
});
内容来源于网络,如有侵权,请联系作者删除!