Java Code Examples for javax.swing.event.TreeSelectionEvent

The following examples show how to use javax.swing.event.TreeSelectionEvent. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: megamek   Source File: CamoChoiceDialog.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public void valueChanged(TreeSelectionEvent ev) {
    if (ev.getSource().equals(treeCategories)) {
        TreePath[] paths = treeCategories.getSelectionPaths();
        // If nothing is selected, there's nothing to populate the table with.
        if (null == paths) {
            return;
        }
        for (TreePath path : paths) {
            Object[] values = path.getPath();
            String category = "";
            for (int i = 1; i < values.length; i++) {
                if (values[i] != null) {
                    String name = (String) ((DefaultMutableTreeNode) values[i])
                            .getUserObject();
                    category += name;
                    if (!name.equals(IPlayer.NO_CAMO)
                            && !name.equals(IPlayer.ROOT_CAMO)) {
                        category += "/";
                    }
                }
            }
            fillTable(category);
        }
    }
}
 
Example 2
Source Project: pdfxtk   Source File: Overview.java    License: Apache License 2.0 6 votes vote down vote up
ThreadPane(String name_, int tabIdx_) {
     name   = name_;
     tabIdx = tabIdx_;
     setLayout(new BorderLayout());
     setName(name + " (" + msgCount + ")");
     jtree.setRootVisible(false);
     jtree.setShowsRootHandles(true);
     jtree.setCellRenderer(new TreeRenderer());
     jtree.setScrollsOnExpand(true); 
     jtree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
     jtree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
  public void valueChanged(TreeSelectionEvent e) {
    if(e.getNewLeadSelectionPath() == null) return;
    if(e.getNewLeadSelectionPath().getLastPathComponent() instanceof LogMessageNode) {
      LogMessage m = ((LogMessageNode)e.getNewLeadSelectionPath().getLastPathComponent()).m;
      info.setText(Const.LOG_STRINGS[m.priority] + " from " + m.thread + " @ " + new Date(m.time).toString() + "\n" +
		   m.message + "\n" + 
		   m.getException());
    }
  }
});
     add(new JScrollPane(jtree), BorderLayout.CENTER);
   }
 
Example 3
Source Project: freeinternals   Source File: JSplitPaneClassFile.java    License: Apache License 2.0 6 votes vote down vote up
private void jTreeClassFileSelectionChanged(final TreeSelectionEvent evt) {
    Object obj = evt.getPath().getLastPathComponent();
    if (obj instanceof DefaultMutableTreeNode) {
        final DefaultMutableTreeNode objDmtn = (DefaultMutableTreeNode) obj;
        obj = objDmtn.getUserObject();
        if (obj instanceof JTreeNodeFileComponent) {
            final JTreeNodeFileComponent objTncc = (JTreeNodeFileComponent) obj;

            // Select the bytes of this data
            this.binaryViewer.setSelection(objTncc.getStartPos(), objTncc.getLength());

            // clear opcode values;
            this.opcode.setText(null);
            // Get the code bytes
            if (AttributeCode.ATTRIBUTE_CODE_NODE.equals(objTncc.getText())) {
                final byte[] data = this.classFile.getClassByteArray(objTncc.getStartPos(), objTncc.getLength());
                this.generateOpcodeParseResult(data);
            }
        }
    }
}
 
Example 4
Source Project: Cafebabe   Source File: ClassMemberList.java    License: GNU General Public License v3.0 6 votes vote down vote up
public ClassMemberList() {
	MethodEditorPanel editor = new MethodEditorPanel(this);
	this.setRootVisible(false);
	this.setShowsRootHandles(false);
	this.setFocusable(false);
	this.setCellRenderer(new MethodListCellRenderer());
	this.addTreeSelectionListener(new TreeSelectionListener() {
		@Override
		public void valueChanged(TreeSelectionEvent e) {
			MethodListNode node = (MethodListNode) getLastSelectedPathComponent();
			if (node != null && node.getMethod() != null) {
				Cafebabe.gui.smallEditorPanel.setViewportView(editor);
				editor.editMethod(node.getMethod());
			}
		}
	});
	this.model = new DefaultTreeModel(root = new MethodListNode(null, null));
	this.setModel(model);
	this.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
}
 
Example 5
Source Project: consulo   Source File: MemberChooser.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void valueChanged(TreeSelectionEvent e) {
  TreePath[] paths = e.getPaths();
  if (paths == null) return;
  for (int i = 0; i < paths.length; i++) {
    Object node = paths[i].getLastPathComponent();
    if (node instanceof MemberNode) {
      final MemberNode memberNode = (MemberNode)node;
      if (e.isAddedPath(i)) {
        if (!mySelectedNodes.contains(memberNode)) {
          mySelectedNodes.add(memberNode);
        }
      }
      else {
        mySelectedNodes.remove(memberNode);
      }
    }
  }
  mySelectedElements = new LinkedHashSet<T>();
  for (MemberNode selectedNode : mySelectedNodes) {
    mySelectedElements.add((T)selectedNode.getDelegate());
  }
}
 
Example 6
Source Project: OpenDA   Source File: TreeDemo.java    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
/** Required by TreeSelectionListener interface. */
public void valueChanged(TreeSelectionEvent e) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode)
                       tree.getLastSelectedPathComponent();

    if (node == null) return;

    Object nodeInfo = node.getUserObject();
    if (node.isLeaf()) {
        BookInfo book = (BookInfo)nodeInfo;
        displayURL(book.bookURL);
        if (DEBUG) {
            System.out.print(book.bookURL + ":  \n    ");
        }
    } else {
        displayURL(helpURL); 
    }
    if (DEBUG) {
        System.out.println(nodeInfo.toString());
    }
}
 
Example 7
Source Project: marathonv5   Source File: TreeIconDemo.java    License: Apache License 2.0 6 votes vote down vote up
/** Required by TreeSelectionListener interface. */
public void valueChanged(TreeSelectionEvent e) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();

    if (node == null)
        return;

    Object nodeInfo = node.getUserObject();
    if (node.isLeaf()) {
        BookInfo book = (BookInfo) nodeInfo;
        displayURL(book.bookURL);
        if (DEBUG) {
            System.out.print(book.bookURL + ":  \n    ");
        }
    } else {
        displayURL(helpURL);
    }
    if (DEBUG) {
        System.out.println(nodeInfo.toString());
    }
}
 
Example 8
Source Project: freeinternals   Source File: JPanelForTree.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Create a panel tool bar to contain a {@code JTree} object.
 *
 * @param jTree The tree to be contained
 * @param frame The parent window
 */
public JPanelForTree(final JTree jTree, final JFrame frame) {
    if (jTree == null) {
        throw new IllegalArgumentException("[tree] cannot be null.");
    }

    this.tree = jTree;
    this.topLevelFrame = frame;
    this.tree.addTreeSelectionListener(new TreeSelectionListener() {

        @Override
        public void valueChanged(final javax.swing.event.TreeSelectionEvent evt) {
            treeSelectionChanged(evt);
        }
    });

    this.toolbar = new JToolBar();
    this.toolbarbtnDetails = new JButton("Details");
    this.initToolbar();

    this.layoutComponents();
}
 
Example 9
Source Project: netbeans   Source File: PathsCustomizer.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void valueChanged(TreeSelectionEvent e) {
    if (e.isAddedPath()) {
        otherTreeSelectionModel.clearSelection();
    }
    int idx = treeModel.getIndexOfChild(treeModel.getRoot(), e.getPath().getLastPathComponent());
    if (idx >= 0) {
        if (otherListModel != null) {
            idx += otherListModel.getSize() + 1;
        }
        if (e.isAddedPath()) {
            list.setSelectionInterval(idx, idx);
        } else {
            list.removeSelectionInterval(idx, idx);
        }
    } else {
        list.clearSelection();
    }
}
 
Example 10
Source Project: netbeans   Source File: PathsCustomizer.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void valueChanged(TreeSelectionEvent e) {
    if (e.isAddedPath()) {
        otherTreeSelectionModel.clearSelection();
    }
    int idx = treeModel.getIndexOfChild(treeModel.getRoot(), e.getPath().getLastPathComponent());
    if (idx >= 0) {
        if (otherListModel != null) {
            idx += otherListModel.getSize() + 1;
        }
        if (e.isAddedPath()) {
            list.setSelectionInterval(idx, idx);
        } else {
            list.removeSelectionInterval(idx, idx);
        }
    } else {
        list.clearSelection();
    }
}
 
Example 11
Source Project: netbeans   Source File: TreeView.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void valueChanged(TreeSelectionEvent ev) {
    TreePath[] paths = tree.getSelectionPaths();

    if (paths == null) {
        // part of bugfix #37279, if DnD is active then is useless select a nearby node
        if (ExplorerDnDManager.getDefault().isDnDActive()) {
            return;
        }

        callSelectionChanged(new Node[0]);
    } else {
        // we need to force no changes to nodes hierarchy =>
        // we are requesting read request, but it is not necessary
        // to execute the next action immediatelly, so postReadRequest
        // should be enough
        readAccessPaths = paths;
        Children.MUTEX.postReadRequest(this);
    }
}
 
Example 12
Source Project: jaamsim   Source File: ObjectSelector.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void valueChanged( TreeSelectionEvent e ) {
	JTree tree = (JTree) e.getSource();
	DefaultMutableTreeNode node = (DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
	if(node == null) {
		// This occurs when we set no selected entity (null) and then
		// force the tree to have a null selected node
		return;
	}

	Object userObj = node.getUserObject();
	if (userObj instanceof Entity) {
		FrameBox.setSelectedEntity((Entity)userObj, false);
	}
	else {
		FrameBox.setSelectedEntity(null, false);
	}
}
 
Example 13
Source Project: niftyeditor   Source File: ElementSelectionListener.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void valueChanged(TreeSelectionEvent e) {
    TreePath path = e.getNewLeadSelectionPath();
    if (path != null) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
        if (!node.isRoot()) {
            try {
                SelectCommand command = CommandProcessor.getInstance().getCommand(SelectCommand.class);
                command.setElement((GElement) node.getUserObject());
                CommandProcessor.getInstance().excuteCommand(command);
            } catch (Exception ex) {
                Logger.getLogger(ElementSelectionListener.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        final JTree temp = (JTree) e.getSource();

        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                temp.updateUI();
            }
        });
    }
}
 
Example 14
/**
 * Called whenever the value of the selection changes.
 * @param e the event that characterizes the change.
 */
public void valueChanged(TreeSelectionEvent e) {

    if (!updatingSelection && tree.getSelectionCount() == 1) {
        TreePath selPath = tree.getSelectionPath();
        Object lastPathComponent = selPath.getLastPathComponent();

        if (!(lastPathComponent instanceof DefaultMutableTreeNode)) {
            Element selElement = (Element) lastPathComponent;

            updatingSelection = true;
            try {
                getEditor().select(selElement.getStartOffset(),
                        selElement.getEndOffset());
            } finally {
                updatingSelection = false;
            }
        }
    }
}
 
Example 15
Source Project: ramus   Source File: AbstractTableView.java    License: GNU General Public License v3.0 6 votes vote down vote up
protected void createInnerComponent() {
    panel.removeAll();
    Attribute[] attributes = getAttributes();
    RootCreater rootCreater = getRootCreater();

    component = new RowTreeTableComponent(engine, qualifier, accessRules,
            rootCreater, attributes, framework);

    rowSet = component.getRowSet();
    table = component.getTable();

    table.getTreeSelectionModel().addTreeSelectionListener(
            new TreeSelectionListener() {
                @Override
                public void valueChanged(TreeSelectionEvent e) {
                    refreshActions();
                }
            });
    refreshActions();
    panel.add(component, BorderLayout.CENTER);
    panel.revalidate();
    panel.repaint();
}
 
Example 16
/**
 * Called whenever the value of the selection changes.
 * @param e the event that characterizes the change.
 */
public void valueChanged(TreeSelectionEvent e) {

    if (!updatingSelection && tree.getSelectionCount() == 1) {
        TreePath selPath = tree.getSelectionPath();
        Object lastPathComponent = selPath.getLastPathComponent();

        if (!(lastPathComponent instanceof DefaultMutableTreeNode)) {
            Element selElement = (Element) lastPathComponent;

            updatingSelection = true;
            try {
                getEditor().select(selElement.getStartOffset(),
                        selElement.getEndOffset());
            } finally {
                updatingSelection = false;
            }
        }
    }
}
 
Example 17
@Override
public void valueChanged(TreeSelectionEvent e) {
	TreePath newLeadSelectionPath = e.getNewLeadSelectionPath();
	if (newLeadSelectionPath == null) {
		selectedRangeAxisConfig = null;
		return;
	}
	Object lastPathComponent = newLeadSelectionPath.getLastPathComponent();
	if (lastPathComponent instanceof RangeAxisConfigTreeNode) {

		RangeAxisConfig selectedConfig = ((RangeAxisConfigTreeNode) lastPathComponent).getUserObject();

		selectedRangeAxisConfig = selectedConfig;

		adaptGUI();

	} else {
		selectedRangeAxisConfig = null;
	}
}
 
Example 18
Source Project: JByteMod-Beta   Source File: ClassTree.java    License: GNU General Public License v2.0 6 votes vote down vote up
public ClassTree(JByteMod jam) {
  this.jbm = jam;
  this.setRootVisible(false);
  this.setShowsRootHandles(true);
  this.setCellRenderer(new TreeCellRenderer());
  this.addTreeSelectionListener(new TreeSelectionListener() {
    public void valueChanged(TreeSelectionEvent e) {
      SortedTreeNode node = (SortedTreeNode) ClassTree.this.getLastSelectedPathComponent();
      if (node == null)
        return;
      if (node.getCn() != null && node.getMn() != null) {
        jam.selectMethod(node.getCn(), node.getMn());
      } else if (node.getCn() != null) {
        jam.selectClass(node.getCn());
      } else {

      }
    }
  });
  this.model = new DefaultTreeModel(new SortedTreeNode(""));
  this.setModel(model);
  this.setTransferHandler(new JarDropHandler(this, 0));
  this.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
}
 
Example 19
/**
 * Called whenever the value of the selection changes.
 * @param e the event that characterizes the change.
 */
public void valueChanged(TreeSelectionEvent e) {

    if (!updatingSelection && tree.getSelectionCount() == 1) {
        TreePath selPath = tree.getSelectionPath();
        Object lastPathComponent = selPath.getLastPathComponent();

        if (!(lastPathComponent instanceof DefaultMutableTreeNode)) {
            Element selElement = (Element) lastPathComponent;

            updatingSelection = true;
            try {
                getEditor().select(selElement.getStartOffset(),
                        selElement.getEndOffset());
            } finally {
                updatingSelection = false;
            }
        }
    }
}
 
Example 20
public void valueChanged(TreeSelectionEvent e)
{
  final TreePath treePath = e.getNewLeadSelectionPath();
  if (treePath == null)
  {
    setSelectedHandler(null);
  }
  else
  {
    final Object o = treePath.getLastPathComponent();
    if (o instanceof DemoHandlerTreeNode)
    {
      DemoHandlerTreeNode handlerNode = (DemoHandlerTreeNode) o;
      DemoHandler handler = handlerNode.getHandler();
      setSelectedHandler(handler);
    }
    else
    {
      setSelectedHandler(null);
    }
  }
}
 
Example 21
Source Project: consulo   Source File: TreeToolbarDecorator.java    License: Apache License 2.0 6 votes vote down vote up
TreeToolbarDecorator(JTree tree, @Nullable final ElementProducer<?> producer) {
  myTree = tree;
  myProducer = producer;
  myAddActionEnabled = myRemoveActionEnabled = myUpActionEnabled = myDownActionEnabled = myTree.getModel() instanceof EditableTreeModel;
  if (myTree.getModel() instanceof EditableTreeModel) {
    createDefaultTreeActions();
  }
  myTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
    @Override
    public void valueChanged(TreeSelectionEvent e) {
      updateButtons();
    }
  });
  myTree.addPropertyChangeListener("enabled", new PropertyChangeListener() {
    @Override
    public void propertyChange(PropertyChangeEvent evt) {
      updateButtons();
    }
  });
}
 
Example 22
Source Project: moa   Source File: ImageTreePanel.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public void valueChanged(TreeSelectionEvent e) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();

    if (node == null) {
        return;
    }

    Object nodeInfo = node.getUserObject();
    if (node.isLeaf()) {
        ImageChart chart = (ImageChart) nodeInfo;
        ImagePanel chPanel = new ImagePanel(chart.getChart());
        chPanel.setMouseWheelEnabled(true);
        chPanel.setMouseZoomable(true);
        chPanel.repaint();
        this.imgPanel.removeAll();
        this.imgPanel.add(chPanel);
        this.imgPanel.updateUI();
    }
}
 
Example 23
@Override
public void valueChanged(TreeSelectionEvent e) {
	TreePath[] paths = getSelectionPaths();
	// If only one item has been selected, then change the text in the
	// description area
	if (paths == null) {
		return;
	}
	if (paths.length == 1) {
		DefaultMutableTreeNode node = (DefaultMutableTreeNode) paths[0].getLastPathComponent();
		if (!node.getAllowsChildren()) {
			ClusterTreeLeaf leaf = (ClusterTreeLeaf) node.getUserObject();
			ObjectVisualizer viz = ObjectVisualizerService.getVisualizerForObject(clusterModel);
			viz.startVisualization(leaf.getId());
		}
	}
}
 
Example 24
Source Project: openjdk-8   Source File: ElementTreePanel.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Called whenever the value of the selection changes.
 * @param e the event that characterizes the change.
 */
public void valueChanged(TreeSelectionEvent e) {

    if (!updatingSelection && tree.getSelectionCount() == 1) {
        TreePath selPath = tree.getSelectionPath();
        Object lastPathComponent = selPath.getLastPathComponent();

        if (!(lastPathComponent instanceof DefaultMutableTreeNode)) {
            Element selElement = (Element) lastPathComponent;

            updatingSelection = true;
            try {
                getEditor().select(selElement.getStartOffset(),
                        selElement.getEndOffset());
            } finally {
                updatingSelection = false;
            }
        }
    }
}
 
Example 25
Source Project: consulo   Source File: UiInspectorAction.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void valueChanged(TreeSelectionEvent e) {
  TreePath path = e.getNewLeadSelectionPath();
  if (path == null) {
    onComponentChanged((Component)null);
    return;
  }
  Object component = path.getLastPathComponent();
  if (component instanceof ComponentNode) {
    Component c = ((ComponentNode)component).getComponent();
    onComponentChanged(c);
  }
  if (component instanceof ClickInfoNode) {
    onComponentChanged(((ClickInfoNode)component).getInfo());
  }
}
 
Example 26
Source Project: android-classyshark   Source File: MethodsCountPanel.java    License: Apache License 2.0 5 votes vote down vote up
private void setup() {
    this.setLayout(new BorderLayout());
    treeModel = new DefaultTreeModel(new DefaultMutableTreeNode(null));
    jTree = new JTree(treeModel);
    jTree.setRootVisible(false);
    jTree.setCellRenderer(new CellRenderer());
    theme.applyTo(jTree);

    DefaultTreeCellRenderer cellRenderer = (DefaultTreeCellRenderer) jTree.getCellRenderer();

    cellRenderer.setFont(new Font("Monospaced", Font.PLAIN, 20));
    jTree.setCellRenderer(cellRenderer);
    jTree.addTreeSelectionListener(new TreeSelectionListener() {
        @Override
        public void valueChanged(TreeSelectionEvent e) {
            Object selection = jTree.getLastSelectedPathComponent();
            DefaultMutableTreeNode defaultMutableTreeNode = (DefaultMutableTreeNode)selection;
            ClassNode node = (ClassNode) defaultMutableTreeNode.getUserObject();
            viewerController.onSelectedMethodCount(node);
        }
    });

    JScrollPane jScrollPane = new JScrollPane(jTree);
    this.setBorder(new EmptyBorder(0,0,0,0));
    this.add(jScrollPane, BorderLayout.CENTER);
    theme.applyTo(jScrollPane);

    jTree.setDragEnabled(true);
    jTree.setTransferHandler(new FileTransferHandler(viewerController));
}
 
Example 27
Source Project: ghidra   Source File: CustomTOCView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void valueChanged(TreeSelectionEvent e) {
	if (isSelectingNodeInternally) {
		// ignore our own selection events, as this method will get called twice if we don't
		return;
	}

	JHelpNavigator navigator = getHelpNavigator();
	HelpModel helpModel = navigator.getModel();

	TreeItem treeItem = getSelectedItem(e, navigator);
	if (treeItem == null) {
		return; // nothing selected
	}

	TOCItem item = (TOCItem) treeItem;
	ID itemID = item.getID();
	if (itemID == null) {
		Msg.debug(this, "No help ID for " + item);
		return;
	}

	String presentation = item.getPresentation();
	if (presentation != null) {
		return; // don't currently support presentations
	}

	CustomTreeItemDecorator customItem = (CustomTreeItemDecorator) item;
	String customDisplayText = customItem.getDisplayText();
	try {
		helpModel.setCurrentID(itemID, customDisplayText, navigator);
	}
	catch (InvalidHelpSetContextException ex) {
		Msg.error(this, "Exception setting new help item ID", ex);
	}
}
 
Example 28
Source Project: ghidra   Source File: CustomTOCView.java    License: Apache License 2.0 5 votes vote down vote up
private TOCItem getSelectedItem(TreeSelectionEvent e, JHelpNavigator navigator) {
	TreePath newLeadSelectionPath = e.getNewLeadSelectionPath();
	if (newLeadSelectionPath == null) {
		navigator.setSelectedItems(null);
		return null;
	}

	DefaultMutableTreeNode node =
		(DefaultMutableTreeNode) newLeadSelectionPath.getLastPathComponent();
	TOCItem treeItem = (TOCItem) node.getUserObject();
	navigator.setSelectedItems(new TreeItem[] { treeItem });

	return treeItem;
}
 
Example 29
Source Project: consulo   Source File: OptionsPanelImpl.java    License: Apache License 2.0 5 votes vote down vote up
public OptionsPanelImpl(ColorAndFontOptions options,
                        SchemesPanel schemesProvider,
                        String categoryName) {
  super(new BorderLayout());
  myOptions = options;
  mySchemesProvider = schemesProvider;
  myCategoryName = categoryName;
  myProperties = PropertiesComponent.getInstance();

  myOptionsPanel = new ColorAndFontDescriptionPanel() {
    @Override
    protected void onSettingsChanged(ActionEvent e) {
      super.onSettingsChanged(e);
      myDispatcher.getMulticaster().settingsChanged();
    }
  };

  myOptionsTree = new ColorOptionsTree(myCategoryName);

  myOptionsTree.addTreeSelectionListener(new TreeSelectionListener() {
    @Override
    public void valueChanged(TreeSelectionEvent e) {
      if (!mySchemesProvider.areSchemesLoaded()) return;
      processListValueChanged();
    }
  });

  JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myOptionsTree);
  add(scrollPane, BorderLayout.CENTER);
  add(myOptionsPanel, BorderLayout.EAST);

}
 
Example 30
private Component createTreePanel() {
    treeComponent = new TaskTreeComponent(gradlePluginLord, new TaskTreeComponent.Interaction() {
        public void rightClick(JTree tree, int x, int y) {
            enableThingsAppropriately();
            popupMenu.show(tree, x, y);
        }

        public void taskInvoked(TaskView task, boolean isCtrlKeyDown) {
            if (isCtrlKeyDown) {
                gradlePluginLord.addExecutionRequestToQueue(task, false, "-a");
            } else {
                gradlePluginLord.addExecutionRequestToQueue(task, false);
            }
        }

        public void projectInvoked(ProjectView project) {
            executeDefaultTasksInProject(project);
        }
    });

    treeComponent.getTree().addTreeSelectionListener(new TreeSelectionListener() {
        public void valueChanged(TreeSelectionEvent e) {
            enableThingsAppropriately();
        }
    });

    defaultTreeBackground = treeComponent.getTree().getBackground();

    treeScrollPane = new JScrollPane();

    treeComponent.getTree().setBackground(workingBackgroundColor);  //change the color to better indicate that
    showTextInViewport("Has not built projects/tasks yet.");

    return treeScrollPane;
}