Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

hashmap K,V into new table row

830384Jan 14 2011 — edited Jan 14 2011
I am trying to display the Key, Value into a new row each time the K,V are read. I am confused as to why ALL K,V are showing up in the same row of my JTable, one right after the other. If I have a get/set as shown below, what else do I need to populate a new row to show the next K,V entry? Thanks!
		public Object getValueAt(int row, int col) 
        {
 
            switch(col)
            {
                case 0:
                	return statushash.keySet().toString();
                case 1:
                	return statushash.values().toString();
            }
            return "";
        }
 
        public void setValueAt(Object value, int row, int col)
        {
            switch(col)
            {
                case 0:
                	statushash.keySet().toString();
                    break;
                case 1:
                	statushash.values().toString();
                    break;
            }
        }
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 11 2011
Added on Jan 14 2011
7 comments
544 views