how will this replace my code.please help
Main Topics
Browse All Topicshello there,
i have a jtree which i want to give access right to privilege users.now when i clcik on the value of the jtree i get a jdialog which says cannot display details because of insufficient privilege.but when i click on the round thingy on the jtree it expands the jtree.
another problem is when i single clcik on the node it does not give access,but when i double clcik on it,the jtree expands.how do i also check for double clcik.
my code is below
tree.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent me) {
Object obj = tree.getLastSelectedPathCo
if(obj != null) {
DefaultMutableTreeNode select = (DefaultMutableTreeNode)ob
//System.out.print("select
System.out.println(select != lastSelectedNode);
if (select != lastSelectedNode)
{
Object uObject = select.getUserObject();
pk = ((BaseRow)uObject).getPrim
fk = ((BaseRow)uObject).getFore
System.out.println(pk);
System.out.println(fk);
switch(((BaseRow)uObject).
case BaseRow.CITY_TYPE : {
changeCard(rightCardPanel,
int index = 0;
if(privilege == 2 || privilege == 3)
{
if(pk == Login.cityVi
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I guess this should be enough:
replace first two lines
tree.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent me) {
with these
tree.addTreeWillExpandList
public treeWillCollapse(TreeExpan
}
public treeWillExpand(TreeExpansi
... // here follows the rest of the code
Business Accounts
Answer for Membership
by: StillUnAwarePosted on 2007-07-08 at 03:33:11ID: 19439635
You should add the TreeWillExpandListerner instead of MouseAdapter:
TreeWillEx pandListen er tel);
ooks/tutor ial/uiswin g/events/ t reewillexp andlistene r.html
there is a convenience method for that in a JTree:
void addTreeWillExpandListener(
see an example on that:
http://java.sun.com/docs/b