Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » converting Swing JTree to SWT Tree
converting Swing JTree to SWT Tree [message #461431] Thu, 22 September 2005 15:25 Go to next message
martin is currently offline martinFriend
Messages: 49
Registered: July 2009
Member
I'm currently converting a software project from Swing to SWT and run into
problems by trying to replace parts of Swing's JTree. It looks like Swing
makes use of a DefaultMutableTreeNode, e.g. for the root node, which is not
given in SWT. Has anybody an idea how I can get rid of that (workaround?)
and if there is a way to address the root node of a Tree in SWT?

Martin
Re: converting Swing JTree to SWT Tree [message #461718 is a reply to message #461431] Wed, 28 September 2005 09:29 Go to previous message
martin is currently offline martinFriend
Messages: 49
Registered: July 2009
Member
Martin Röhricht wrote:
> I'm currently converting a software project from Swing to SWT and run into
> problems by trying to replace parts of Swing's JTree. It looks like Swing
> makes use of a DefaultMutableTreeNode, e.g. for the root node, which is
> not given in SWT. Has anybody an idea how I can get rid of that
> (workaround?) and if there is a way to address the root node of a Tree in
> SWT?

I think I got the solution for that (I worked with an old SWT API :-(). SWT
provides TreeItems instead of DefaultMutableTreeNodes and further more the
option to set the rootNode by using the setTopItem() function:

Tree tree = new Tree(this, SWT.SINGLE | SWT.BORDER);
rootNode = new TreeItem(tree, SWT.NULL);
rootNode.setText("Root");
tree.setTopItem(rootNode);

One question still remains open besides that but concerning Trees. Is it
right to remove a TreeItem by using the dispose() method? Because I can't
find any method like removeItem(int index) or something like that.

Martin
Previous Topic:showing a view
Next Topic:Tricky problem with FocusListener
Goto Forum:
  


Current Time: Thu Apr 25 15:45:53 GMT 2024

Powered by FUDForum. Page generated in 0.02682 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top