Java 8 TreeSelectionModel - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 TreeSelectionModel class.

This code example shows how to use the following methods:setSelectionMode
                        .contains("showing=false"); 
  } 
 
  @RunsInEDT 
  private void setContiguousSelectionMode() { 
    TreeSelectionModel selectionModel = new DefaultTreeSelectionModel();
    selectionModel.setSelectionMode(CONTIGUOUS_TREE_SELECTION);
    setSelectionModel(tree, selectionModel);
  } 
 
  @Test
  public void should_format_JTree_without_TreeSelectionModel() { 
    setSelectionModel(tree, null);
    String formatted = formatter.format(tree);
    assertThat(formatted).contains("javax.swing.JTree")
                         .contains("name='tree'") 
                         .contains("selectionCount=0") 
                         .contains("selectionPaths=[]") 
                         .contains("selectionMode=DISCONTIGUOUS_TREE_SELECTION") 
                         .contains("enabled=true") 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setSelectionMode
This code example shows how to use the following methods:getSelectionMode
    return pathArray;
  } 
 
  private @Nullable String selectionMode(JTree tree) {
    TreeSelectionModel model = tree.getSelectionModel();
    return SELECTION_MODES.get(model.getSelectionMode());
  } 
 
  /** 
   * @return {@code JTree.class}. 
   */ 
  @Override 
  public @Nonnull Class<? extends Component> targetType() {
    return JTree.class;
  } 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addTreeSelectionListener, getSelectionPath
        this.selectionListener = new TreeSelectionListener() {
            public void valueChanged(TreeSelectionEvent e) {
                reactToSelection(); 
            } 
        }; 
        selectionModel.addTreeSelectionListener(selectionListener);
        setEnabled(canPerform(getSelectedOWLEntity())); 
    } 
 
 
    // Called on a selection history to enable/disable 
    // the action. 
    private void reactToSelection() { 
        // Ask subclasses if we should be enabled for the current 
        // selection 
        setEnabled(canPerform(getSelectedOWLEntity())); 
    } 
 
 
    protected abstract boolean canPerform(E selEntity);

4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 TreeSelectionModel Methods: