🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Nokomo Tue, 31 Dec 2002 20:46
Jtree and Hashtable order
#589
Author: Nokomo
Date: Tue, 31 Dec 2002 20:46
10 lines
1561 bytes
Hi

i insert some element into a hashtable and then i give hashtable to a JTree
to show those elements as tree.
My problem:
I want JTree to show my element in the order that i insert them into
hashtable how to do that?
I will be happy if anyone can give me some direction, ida,...
Thanks
Nokomo
Re: Jtree and Hashtable order
#590
Author: Christopher Dean
Date: Fri, 03 Jan 2003 00:58
18 lines
2057 bytes
Nokomo wrote:

> Hi
>
> i insert some element into a hashtable and then i give hashtable to a 
> JTree
> to show those elements as tree.
> My problem:
> I want JTree to show my element in the order that i insert them into
> hashtable how to do that?
> I will be happy if anyone can give me some direction, ida,...
> Thanks
> Nokomo
>
>
If you are using JDK 1.4  use a LinkedHashMap instead of hashtable and 
when you iterate through the keySet to create the Tree you will get them 
in order.
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