ALongpwneage
Programmer
- May 17, 2007
- 6
Trying to Return the Current and previous values in the HashMap, but is only returning the current keys. Any advise will be much appreciated. Thanks
The code:
private void saveJButtonActionPerformed( ActionEvent event )
{
int x = 0;
//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());
}
The code:
private void saveJButtonActionPerformed( ActionEvent event )
{
int x = 0;
//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());
}