Code
import java.util.*;
import javax.swing.*;
import javax.swing.table.*;
public class JCMap extends JFrame
{
private void makeGUI()
{
this.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
HashMap<String, String> map = new HashMap<String, String>();
map.put("key1", "value1");
map.put("key2", "value2");
DefaultTableModel model = new DefaultTableModel();
model.setColumnIdentifiers(new String[] {"key", "value"});
for (String key : map.keySet())
model.addRow(new Object[] {key, map.get(key)});
JTable table = new JTable(model);
this.getContentPane().add(new JScrollPane(table));
this.setSize(200,200);
this.setLocation(200,200);
this.validate();
this.setVisible(true);
}
public static void main(String[] args)
{
new JCMap().makeGUI();
}
}