The Artima Developer Community
Sponsored Link

Java Answers Forum
TreeMap problems!

3 replies on 1 page. Most recent reply: Apr 2, 2002 9:02 AM by Eduardo

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Eduardo

Posts: 21
Nickname: eduardo
Registered: Feb, 2002

TreeMap problems! Posted: Apr 2, 2002 6:22 AM
Reply to this message Reply
Advertisement
I'm trying to display TreeMap in the textArea, but it gives me the message bellow. Does anybody have a clue about why it is happening? The code looks fine!

Thanks!


TreeMap mSolutionq = new TreeMap();

mSolutionq.put(indexF, solutionq);


ListIterator d = mSolutionq.listIterator();
while ( d.hasNext() )
{
textArea.append( d.next() );
}


--------------------Configuration: EGARapidPrototype - JDK version 1.3.1_01 <Default>--------------------
C:\EGARapidPrototype\EGARapidPrototype\Fire DirectoryChooser.java:246: cannot resolve symbol
symbol : method listIterator ()
location: class java.util.TreeMap
ListIterator d = mSolutionq.listIterator();
^
C:\EGARapidPrototype\EGARapidPrototype\FireDirectoryChooser.java:249: append(java.lang.String) in javax.swing.JTextArea cannot be applied to (java.lang.Object)
textArea.append( d.next() );
^
2 errors

Process completed.


Singh M.

Posts: 154
Nickname: ms
Registered: Mar, 2002

Re: TreeMap problems! Posted: Apr 2, 2002 6:36 AM
Reply to this message Reply
is there a method by the name of listIterator in TreeMap class??

Eduardo

Posts: 21
Nickname: eduardo
Registered: Feb, 2002

Re: TreeMap problems! Posted: Apr 2, 2002 7:08 AM
Reply to this message Reply
Well... I haven't seen, so far. I've tried just iterator, as well and it didn't work. If so, how can I include it in the "append()"?

Eduardo

Posts: 21
Nickname: eduardo
Registered: Feb, 2002

Partially solved! Posted: Apr 2, 2002 9:02 AM
Reply to this message Reply
Yeah... I've tried this code and it works. I just have to find out how to use it, now.

for (Iterator i=mSolutionq.entrySet().iterator(); i.hasNext(); ) {
Map.Entry e = (Map.Entry) i.next();
textArea.append(e.getKey() + ": " + e.getValue()+'\n');

Flat View: This topic has 3 replies on 1 page
Topic: Resultset TYPE_SCROLL_INSENSITIVE Previous Topic   Next Topic Topic: How to get file name

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use