Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TreeMap Problem

Status
Not open for further replies.

ALongpwneage

Programmer
Joined
May 17, 2007
Messages
6
I am displaying the TreeMap in a gui interface, and i am trying to return both the current and previous keys, but it is only returning one. If anyone has a idea on how to return both it would be much appreciated. My code is below.


private void saveJButtonActionPerformed( ActionEvent event )
{

//Creates the tree map and the values that will be placed in the map
TreeMap hm = new TreeMap();
hm.put("Average Attendance ", subtotalJTextField.getText());
hm.put("1)",Name1JTextFeild.getText());
hm.put("Attendance", Members1JTextFeild.getText());
hm.put("2)",Name2JLabel.getText());
hm.put("Attendance", Members2JTextFeild.getText());
hm.put("3)",Name3JLabel.getText());
hm.put("Attendance", Members3JTextFeild.getText());
Set set = hm.entrySet();

Iterator i = set.iterator();


//displays the values in the map
while( i.hasNext())
{

Map.Entry me = (Map.Entry)i.next();
DisplayAttendance.setText(me.getKey() + " : " + me.getValue());
System.out.println(me.getKey() + " " + me.getValue());


}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top