🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.java.gui
3 messages
3 total messages Started by appdev888 Fri, 08 Jan 1999 00:00
extends DefaultMutableTreeNode
#62
Author: appdev888
Date: Fri, 08 Jan 1999 00:00
12 lines
1389 bytes
I built a prototype where a hierarchy is built using the
DefaultMutableTreeNode directly. I didn't need to build any mouseListener and
the branch explansion worked perfectly.

Now I am building the real app. To optimize code reuse, we choose to extend
DefaultMutableTreeNode to incorporate our business logic in it.  Without
building any mouseListener like the prototype, the tree doesn't expand even
when I click on it.  So we build the mouseListener to the tree itself and it
only works as I debug in JBuilder.  Does anyone have any idea?

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    
Re: extends DefaultMutableTreeNode
#63
Author: appdev888
Date: Fri, 08 Jan 1999 00:00
46 lines
2692 bytes
I looked into this more.  The mouseClicked method works as far as identifying
the click, the # of clicks and the closest path for the click; however, the
expandPath doesn't expand that path at all (unless in the debug mode again).
The following is a snippet of my code:

// tree is an instance of JTree
tree.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
               this_mouseClicked(e);
            }
});

public void this_mouseClicked(MouseEvent e)
{
   TreePath path = tree.getClosestPathForLocation(e.getX(), e.getY());
   if (path != null)
   {
       // ReportableEntityNode extends DefaultMutableTreeNode
       ReportableEntityNode node =
                       (ReportableEntityNode)path.getLastPathComponent();
       System.out.println("click " + e.getClickCount() + " on "
                               + node.getThisEntity().getID_RSSD());
       tree.expandPath(path);
   }
}

Does anyone have any clue?  Thank you!

In article <775fhd$dkj$1@nnrp1.dejanews.com>,
  appdev888@my-dejanews.com wrote:
> I built a prototype where a hierarchy is built using the
> DefaultMutableTreeNode directly. I didn't need to build any mouseListener and
> the branch explansion worked perfectly.
>
> Now I am building the real app. To optimize code reuse, we choose to extend
> DefaultMutableTreeNode to incorporate our business logic in it.  Without
> building any mouseListener like the prototype, the tree doesn't expand even
> when I click on it.  So we build the mouseListener to the tree itself and it
> only works as I debug in JBuilder.  Does anyone have any idea?
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    
Re: extends DefaultMutableTreeNode
#61
Author: appdev888
Date: Thu, 21 Jan 1999 00:00
56 lines
3172 bytes
I have upgraded to use swing 1.0.3 instead of 1.0.2 and my problems went away.
Just thought to share this with you all.

In article <775vqr$t3b$1@nnrp1.dejanews.com>,
  appdev888@my-dejanews.com wrote:
> I looked into this more.  The mouseClicked method works as far as identifying
> the click, the # of clicks and the closest path for the click; however, the
> expandPath doesn't expand that path at all (unless in the debug mode again).
> The following is a snippet of my code:
>
> // tree is an instance of JTree
> tree.addMouseListener(new MouseAdapter() {
>             public void mouseClicked(MouseEvent e) {
>                this_mouseClicked(e);
>             }
> });
>
> public void this_mouseClicked(MouseEvent e)
> {
>    TreePath path = tree.getClosestPathForLocation(e.getX(), e.getY());
>    if (path != null)
>    {
>        // ReportableEntityNode extends DefaultMutableTreeNode
>        ReportableEntityNode node =
>                        (ReportableEntityNode)path.getLastPathComponent();
>        System.out.println("click " + e.getClickCount() + " on "
>                                + node.getThisEntity().getID_RSSD());
>        tree.expandPath(path);
>    }
> }
>
> Does anyone have any clue?  Thank you!
>
> In article <775fhd$dkj$1@nnrp1.dejanews.com>,
>   appdev888@my-dejanews.com wrote:
> > I built a prototype where a hierarchy is built using the
> > DefaultMutableTreeNode directly. I didn't need to build any mouseListener
and
> > the branch explansion worked perfectly.
> >
> > Now I am building the real app. To optimize code reuse, we choose to extend
> > DefaultMutableTreeNode to incorporate our business logic in it.  Without
> > building any mouseListener like the prototype, the tree doesn't expand even
> > when I click on it.  So we build the mouseListener to the tree itself and it
> > only works as I debug in JBuilder.  Does anyone have any idea?
> >
> > -----------== Posted via Deja News, The Discussion Network ==----------
> > http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
> >
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads