本文整理了Java中javax.swing.JTree.getLastSelectedPathComponent()
方法的一些代码示例,展示了JTree.getLastSelectedPathComponent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.getLastSelectedPathComponent()
方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:getLastSelectedPathComponent
暂无
代码示例来源:origin: SonarSource/sonarqube
@Override
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) componentTree.getLastSelectedPathComponent();
if (node == null) {
// Nothing is selected.
return;
}
frame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
updateDetails((Component) node.getUserObject());
frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
代码示例来源:origin: skylot/jadx
private void treeClickAction() {
try {
Object obj = tree.getLastSelectedPathComponent();
if (obj == null) {
return;
}
if (obj instanceof JResource) {
JResource res = (JResource) obj;
ResourceFile resFile = res.getResFile();
if (resFile != null && JResource.isSupportedForView(resFile.getType())) {
tabbedPane.showResource(res);
}
} else if ((obj instanceof JCertificate) || (obj instanceof ApkSignature)) {
tabbedPane.showSimpleNode((JNode) obj);
} else if (obj instanceof JNode) {
JNode node = (JNode) obj;
JClass cls = node.getRootClass();
if (cls != null) {
tabbedPane.codeJump(new JumpPosition(cls, node.getLine()));
}
}
} catch (Exception e) {
LOG.error("Content loading error", e);
}
}
代码示例来源:origin: runelite/runelite
widgetTree.getSelectionModel().addTreeSelectionListener(e ->
Object selected = widgetTree.getLastSelectedPathComponent();
if (selected instanceof WidgetTreeNode)
代码示例来源:origin: stackoverflow.com
tree.getLastSelectedPathComponent();
代码示例来源:origin: INRIA/spoon
@Override
public void actionPerformed(ActionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree
.getLastSelectedPathComponent();
if (node == null) {
node = root;
}
expandAll(node);
}
});
代码示例来源:origin: INRIA/spoon
@Override
public void actionPerformed(ActionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree
.getLastSelectedPathComponent();
if (node == null) {
node = root;
}
new SpoonObjectFieldsTable(node.getUserObject());
}
});
代码示例来源:origin: INRIA/spoon
@Override
public void keyTyped(KeyEvent e) {
switch (e.getKeyChar()) {
case ('s'):
break;
case ('n'):
next();
break;
case ('o'):
if (jTree.getLastSelectedPathComponent() != null) {
new SpoonObjectFieldsTable(((DefaultMutableTreeNode) jTree
.getLastSelectedPathComponent()).getUserObject());
}
break;
}
}
代码示例来源:origin: INRIA/spoon
/** shows a dialog to enter the value to search for in the AST */
public DefaultMutableTreeNode search() {
searchValue = JOptionPane.showInputDialog(this,
"Enter value to search:", "Search");
DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree
.getLastSelectedPathComponent();
if (node == null) {
node = root;
}
enume = node.depthFirstEnumeration();
if (searchValue != null) {
return next();
}
return null;
}
代码示例来源:origin: ron190/jsql-injection
@Override
public void valueChanged(TreeSelectionEvent arg0) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) MediatorGui.treeDatabase().getLastSelectedPathComponent();
// Get rid of java.lang.NullPointerException
if (node == null) {
return;
}
if (node.getUserObject() instanceof AbstractNodeModel) {
AbstractNodeModel dataModel = (AbstractNodeModel) node.getUserObject();
if (!dataModel.isLoaded()) {
dataModel.runAction();
}
}
}
代码示例来源:origin: ron190/jsql-injection
@Override
public void focusLost(FocusEvent e) {
DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) ManagerDatabase.this.tree.getLastSelectedPathComponent();
if (treeNode != null) {
AbstractNodeModel nodeModel = (AbstractNodeModel) treeNode.getUserObject();
if (nodeModel != null && nodeModel.getPanel() != null) {
nodeModel.getPanel().getLabel().setBackground(HelperUi.COLOR_FOCUS_LOST);
nodeModel.getPanel().getLabel().setBorder(HelperUi.BORDER_FOCUS_LOST);
}
}
}
代码示例来源:origin: ron190/jsql-injection
@Override
public void focusGained(FocusEvent e) {
DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) ManagerDatabase.this.tree.getLastSelectedPathComponent();
if (treeNode != null) {
AbstractNodeModel nodeModel = (AbstractNodeModel) treeNode.getUserObject();
if (nodeModel != null && nodeModel.getPanel() != null) {
nodeModel.getPanel().getLabel().setBackground(HelperUi.COLOR_FOCUS_GAINED);
nodeModel.getPanel().getLabel().setBorder(HelperUi.BORDER_FOCUS_GAINED);
}
}
}
代码示例来源:origin: ron190/jsql-injection
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_F2) {
DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) ManagerDatabase.this.tree.getLastSelectedPathComponent();
if (treeNode != null) {
AbstractNodeModel nodeModel = (AbstractNodeModel) treeNode.getUserObject();
if (nodeModel != null && nodeModel.getPanel() != null && !nodeModel.isRunning()) {
nodeModel.getPanel().getLabel().setBackground(HelperUi.COLOR_FOCUS_LOST);
nodeModel.getPanel().getLabel().setBorder(HelperUi.BORDER_FOCUS_LOST);
nodeModel.setIsEdited(true);
}
}
}
}
代码示例来源:origin: knowm/XChart
@Override
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
代码示例来源:origin: knowm/XChart
@Override
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
代码示例来源:origin: org.antlr/stringtemplate
public void valueChanged(TreeSelectionEvent treeSelectionEvent) {
currentScope = ((JTreeSTModel.Wrapper)viewFrame.tree.getLastSelectedPathComponent()).event.scope;
updateCurrentST(viewFrame);
}
}
代码示例来源:origin: freeplane/freeplane
public void valueChanged(final TreeSelectionEvent e) {
final DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
btnOK.setEnabled(node != null && nodeIsSelectable(node));
}
});
代码示例来源:origin: net.imagej/ij
/** Fires an ActionEvent upon double-click on the plugin item (leaf node) in the JTree */
void toAction() {
DefaultMutableTreeNode nde=(DefaultMutableTreeNode)pTree.getLastSelectedPathComponent();
// if the node has children then do nothing (return)
if (nde.getChildCount()>0) return;
String aCmd=nde.toString();
String cmd= aCmd;
if(pcp.treeCommands.containsKey(aCmd))
cmd = (String)pcp.treeCommands.get(aCmd);
processEvent(new ActionEvent(this,ActionEvent.ACTION_PERFORMED,cmd));
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
public void actionPerformed(ActionEvent e) {
if (((GOETreeNode)tree.getLastSelectedPathComponent()).isLeaf()) {
popup.setVisible(false);
}
}
});
代码示例来源: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: BaseXdb/basex
@Override
public boolean isCellEditable(final EventObject event) {
// check if chosen node is not the root node
final Object node = tree.getLastSelectedPathComponent();
return super.isCellEditable(event) && node instanceof TreeNode &&
((TreeNode) node).getParent().getParent() != null;
}
}
内容来源于网络,如有侵权,请联系作者删除!