@@ -0,0 +1,2404 @@
+package util;%0A%0Aimport java.awt.BorderLayout;%0A%0Aimport javax.swing.BoxLayout;%0Aimport javax.swing.JFrame;%0Aimport javax.swing.JPanel;%0Aimport javax.swing.border.EmptyBorder;%0Aimport javax.swing.JScrollPane;%0Aimport javax.swing.JLabel;%0Aimport java.awt.Component;%0Aimport javax.swing.Box;%0Aimport java.util.Collection;%0A%0Aimport org.joda.time.DateTime;%0Aimport java.awt.Color;%0A%0A/**%0A * A visual %7B@link Collection%7D inspector.%0A * Displays the string representation of the input collection, refreshes every 2 seconds.%0A * @author Balazs Pete%0A *%0A */%0A@SuppressWarnings(%22rawtypes%22)%0Apublic class CollectionInspector extends Thread %7B%0A%0A%09private JPanel contentPane;%0A%09private JScrollPane scrollPane;%0A%09private Collection collection;%0A%0A%09/**%0A%09 * Create the frame.%0A%09 */%0A%09public CollectionInspector(Collection collection, String title) %7B%0A%09%09this.collection = collection;%0A%09%09JFrame frame = new JFrame();%0A%09%09%0A%09%09frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);%0A%09%09frame.setBounds(100, 100, 450, 300);%0A%09%09frame.setTitle(title);%0A%09%09contentPane = new JPanel();%0A%09%09contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));%0A%09%09contentPane.setLayout(new BorderLayout(0, 0));%0A%09%09frame.setContentPane(contentPane);%0A%09%09%0A%09%09JPanel panel = new JPanel();%0A%09%09contentPane.add(panel, BorderLayout.NORTH);%0A%09%09%0A%09%09JLabel lblSize = new JLabel(%22Size: %22 + collection.size());%0A%09%09panel.add(lblSize);%0A%09%09%0A%09%09Component horizontalStrut = Box.createHorizontalStrut(20);%0A%09%09panel.add(horizontalStrut);%0A%09%09%0A%09%09JLabel lblLastupdated = new JLabel(%22Last updated: %22 + DateTime.now().toString(%22HH:mm:ss%22));%0A%09%09panel.add(lblLastupdated);%0A%09%09%0A%09%09scrollPane = new JScrollPane();%0A%09%09contentPane.add(scrollPane, BorderLayout.CENTER);%0A%09%09%0A%09%09frame.setVisible(true);%0A%09%09update();%0A%09%7D%0A%0A%09private void update() %7B%0A%09%09JPanel panel_1 = new JPanel();%0A%09%09panel_1.setLayout(new BoxLayout(panel_1, BoxLayout.Y_AXIS)); %0A%09%09panel_1.setSize(scrollPane.getWidth(), 1000);%0A%09%09scrollPane.setViewportView(panel_1);%0A%09%09%0A%09%09%0A%09%09int i = 0;%0A%09%09for (Object entry : collection) %7B%0A%09%09%09JPanel horizontalBox = new JPanel();%0A%09%09%09panel_1.add(horizontalBox);%0A%09%09%09%0A%09%09%09JLabel lblIndex = new JLabel(i++ + %22:%22);%0A%09%09%09lblIndex.setForeground(Color.GRAY);%0A%09%09%09horizontalBox.add(lblIndex);%0A%09%09%09%0A%09%09%09JLabel lblTostring = new JLabel(entry.toString());%0A%09%09%09horizontalBox.add(lblTostring);%0A%09%09%7D%0A%09%7D%0A%09%0A%09public void run() %7B%0A%09%09try %7B%0A%09%09%09sleep(2000);%0A%09%09%7D catch (InterruptedException e) %7B%0A%09%09%09System.err.println(%22Failed to sleep: %22 + e.getMessage());%0A%09%09%7D%0A%09%09update();%0A%09%7D%0A%7D%0A

Add collection inspector