how to click a button, a node in a tree is selected

H

HS1

Hello all

I have a MenuTreeNavigator in a MainWindow that allows users to select
different nodes as the following:
----------------------------------------------------------------------------
----------------------------

public class MenuTreeNavigator implements TreeSelectionListener,
TreeExpansionListener {

......

public MenuTreeNavigator(MainWindow mainWindow) {

this.mainWindow = mainWindow;

.........

public void valueChanged(TreeSelectionEvent treeSelectionEvent) {

Object selectedNode = treeSelectionEvent.getPath().getLastPathComponent();

if (selectedNode.getClass().getName().equals("MainClientNode")) {

//MainClientNode is a class MainClientNode that implements
MutableTreeNode

MainClientNode clientNode = (MainClientNode) selectedNode;

mainWindow.setRightPane(.........);

}

if (selectedNode.getClass().getName().equals("ClientNode")) {

....

}

----------------------------------------------------------------------------

When user click s(or select) a MainClientNode, the MainWindow will set a
object for RightPane. What I want now is that I have a button in the
MainWindow, when I click this button, that MainClienNode is also selected
(as I have only one MainClientNode)

Is it possible to do that?

Please help

Many thanks

S.H1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top