ALongpwneage
Programmer
- May 17, 2007
- 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());
}
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());
}