javax.swing.JTree.revalidate()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(110)

本文整理了Java中javax.swing.JTree.revalidate()方法的一些代码示例,展示了JTree.revalidate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.revalidate()方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:revalidate

JTree.revalidate介绍

暂无

代码示例

代码示例来源:origin: ron190/jsql-injection

@Override
public void focusLost(FocusEvent e) {
  AbstractNodeModel nodeModel = (AbstractNodeModel) currentNode.getUserObject();
  nodeModel.setIsEdited(false);
  tree.revalidate();
  tree.repaint();
}

代码示例来源:origin: ron190/jsql-injection

@Override
public void keyPressed(KeyEvent e) {
  AbstractNodeModel nodeModel = (AbstractNodeModel) currentNode.getUserObject();
  if (e.getKeyCode() == KeyEvent.VK_F2 && !nodeModel.isRunning()) {
    nodeModel.setIsEdited(true);
    
    PanelNode.this.label.setVisible(false);
    PanelNode.this.textFieldEditable.setVisible(true);
    PanelNode.this.textFieldEditable.requestFocusInWindow();
    
    tree.revalidate();
    tree.repaint();
  }
}

代码示例来源:origin: ron190/jsql-injection

PanelNode.this.label.setText(StringUtil.detectUtf8Html(nodeModel.getElementDatabase().getLabelCount()));
  tree.revalidate();
  tree.repaint();
});

代码示例来源:origin: ron190/jsql-injection

DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
model.reload(root);
MediatorGui.managerDatabase().getTree().revalidate();

代码示例来源:origin: sdedit/sdedit

public void run() {
    navigationTree.revalidate();
    contentPanel.revalidate();
    repaint();
    for (TreeNavigatorPaneListener listener : listeners) {
      listener.componentSelected(comp);
    }
  }
});

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

@Override
 public void run()
 {
  _tree.setModel( new DefaultTreeModel( beanTree1 ) );
  _tree.setSelectionRow( 0 );
  _tree.revalidate();
  _tree.repaint();
 }
} );

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

void filterDisplay()
 {
//    if( _bShowBeanRoots )
//    {
//      // Only filtering for "code completion" popups.
//      return;
//    }

  String strWholePath = TextComponentUtil.getWordBeforeCaret( _editor );
  String strPrefix = strWholePath;
  if( strWholePath != null && strWholePath.length() > 0 )
  {
   int iDotIndex = strWholePath.lastIndexOf( '.' );
   if( iDotIndex >= 0 )
   {
    strPrefix = strWholePath.substring( iDotIndex + 1 );
   }
  }

  BeanTree beanTree = new BeanTree( _classes[0], null, "", strPrefix, false );

  _tree.setModel( new DefaultTreeModel( beanTree ) );
  _tree.setSelectionRow( 0 );
  _tree.revalidate();
  _tree.repaint();
 }

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor

@Override
public void mouseClicked(MouseEvent e) {
  int x = e.getX();
  int y = e.getY();
  int row = tree.getRowForLocation(x, y);
  TreePath path = tree.getPathForRow(row);
  //TreePath  path = tree.getSelectionPath();
  if (path != null) {
    CheckNode node = (CheckNode) path.getLastPathComponent();
    boolean isSelected = !(node.isSelected());
    node.setSelected(isSelected);
    ((DefaultTreeModel) tree.getModel()).nodeChanged(node);
    tree.revalidate();
    tree.repaint();
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-localhistory

@Override
public void mouseClicked(MouseEvent e) {
  JTree tree = (JTree) e.getSource();
  Point p = e.getPoint();
  int row = tree.getRowForLocation(e.getX(), e.getY());
  TreePath path = tree.getPathForRow(row);
  
  // if path exists and mouse is clicked exactly once
  if (path != null) {
    FileNode node = (FileNode) path.getLastPathComponent();
    Rectangle chRect = DeletedListRenderer.getCheckBoxRectangle();
    Rectangle rowRect = tree.getPathBounds(path);
    chRect.setLocation(chRect.x + rowRect.x, chRect.y + rowRect.y);
    if (e.getClickCount() == 1 && chRect.contains(p)) {
      boolean isSelected = !(node.isSelected());
      node.setSelected(isSelected);
      ((DefaultTreeModel) tree.getModel()).nodeChanged(node);
      if (row == 0) {
        tree.revalidate();
      }
      tree.repaint();
    }
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor

@Override
public void keyPressed(KeyEvent e) {
  if (e.getKeyCode() == KeyEvent.VK_SPACE) {
    if (e.getSource() instanceof JTree) {
      JTree t = (JTree) e.getSource();
      TreePath path = t.getSelectionPath();
      if (path != null) {
        CheckNode node = (CheckNode) path.getLastPathComponent();
        boolean isSelected = !(node.isSelected());
        node.setSelected(isSelected);
        ((DefaultTreeModel) tree.getModel()).nodeChanged(node);
        tree.revalidate();
        tree.repaint();
      }
      e.consume();
    }
  }
}

代码示例来源:origin: igniterealtime/Spark

public void mouseClicked(MouseEvent e) {
    int x = e.getX();
    int y = e.getY();
    int row = tree.getRowForLocation(x, y);
    TreePath path = tree.getPathForRow(row);
    if (path != null) {
      CheckNode node = (CheckNode)path.getLastPathComponent();
      boolean isSelected = !node.isSelected();
      node.setSelected(isSelected);
      if (node.getSelectionMode() == CheckNode.DIG_IN_SELECTION) {
        if (isSelected) {
          //tree.expandPath(path);
        }
        else {
          //tree.collapsePath(path);
        }
      }
      ((DefaultTreeModel)tree.getModel()).nodeChanged(node);
      // I need revalidate if node is root.  but why?
      tree.revalidate();
      tree.repaint();
    }
  }
}

代码示例来源:origin: org.gephi/directory-chooser

tree.revalidate();
tree.repaint();

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

_tree.revalidate();
_tree.repaint();

代码示例来源:origin: org.n52.wps/52n-wps-install-wizard

public void mouseClicked(MouseEvent e) {
  int x = e.getX();
  int y = e.getY();
  int row = tree.getRowForLocation(x, y);
  TreePath  path = tree.getPathForRow(row);
  //TreePath  path = tree.getSelectionPath();
  if (path != null) {
   CheckNode node = (CheckNode)path.getLastPathComponent();
   boolean isSelected = ! (node.isSelected());
   node.setSelected(isSelected);
   if (node.getSelectionMode() == CheckNode.DIG_IN_SELECTION) {
    if ( isSelected ) {
     tree.expandPath(path);
    } else {
     tree.collapsePath(path);
    }
   }
   ((DefaultTreeModel)tree.getModel()).nodeChanged(node);
   // I need revalidate if node is root.  but why?
   if (row == 0) {
    tree.revalidate();
    tree.repaint();
   }
  }
 }
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

_tree.revalidate();
_tree.repaint();

代码示例来源:origin: org.cytoscape/cpath2-impl

/**
   * Mouse Click Event.
   *
   * @param e MouseEvent Object.
   */
  public void mouseClicked(MouseEvent e) {
    int x = e.getX();
    int y = e.getY();
    int row = tree.getRowForLocation(x, y);
    TreePath path = tree.getPathForRow(row);
    if (path != null) {
      CheckNode node = (CheckNode) path.getLastPathComponent();
      boolean isSelected = !(node.isSelected());
      node.setSelected(isSelected);
      if (node.getSelectionMode() == CheckNode.DIG_IN_SELECTION) {
        if (isSelected) {
          tree.expandPath(path);
        } else {
          tree.collapsePath(path);
        }
      }
      ((DefaultTreeModel) tree.getModel()).nodeChanged(node);
      if (row == 0) {
        tree.revalidate();
        tree.repaint();
      }
    }
  }
}

代码示例来源:origin: cytoscape.coreplugins/cpath2

/**
   * Mouse Click Event.
   *
   * @param e MouseEvent Object.
   */
  public void mouseClicked(MouseEvent e) {
    int x = e.getX();
    int y = e.getY();
    int row = tree.getRowForLocation(x, y);
    TreePath path = tree.getPathForRow(row);
    if (path != null) {
      CheckNode node = (CheckNode) path.getLastPathComponent();
      boolean isSelected = !(node.isSelected());
      node.setSelected(isSelected);
      if (node.getSelectionMode() == CheckNode.DIG_IN_SELECTION) {
        if (isSelected) {
          tree.expandPath(path);
        } else {
          tree.collapsePath(path);
        }
      }
      ((DefaultTreeModel) tree.getModel()).nodeChanged(node);
      if (row == 0) {
        tree.revalidate();
        tree.repaint();
      }
    }
  }
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

_tree.setModel( new DefaultTreeModel( beanTree1 ) );
 _tree.setSelectionRow( 0 );
 _tree.revalidate();
 _tree.repaint();
} );

代码示例来源:origin: org.icepdf.os/icepdf-viewer

((DefaultTreeModel) tree.getModel()).nodeChanged(node);
if (row == 0) {
  tree.revalidate();
  tree.repaint();

代码示例来源:origin: edu.utah.bmi.nlp/nlp-core

this.selectedAnnotationTree.revalidate();
this.horizontalSplitPane.revalidate();
expandAll(this.selectedAnnotationTree);

相关文章

JTree类方法