package com.nigorojr.typebest;

import java.awt.FlowLayout;
import java.text.DateFormat;

import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneLayout;

@SuppressWarnings("serial")
public class RecordsWindow extends JFrame {
    private JPanel recordsPanel = new JPanel();

    public RecordsWindow(Records records) {
        super("Records");

        setSize(800, 500);
        setPreferredSize(getSize());

        recordsPanel.setLayout(new BoxLayout(recordsPanel, BoxLayout.PAGE_AXIS));
        addRecords(records);

        JScrollPane jsp = new JScrollPane(recordsPanel);
        jsp.setLayout(new ScrollPaneLayout());
        add(jsp);

        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setLocationRelativeTo(null);
    }

    private void addRecords(Records records) {
        Record[] recordArray = records.getAllRecords();
        for (Record r : recordArray) {
            JPanel p = new JPanel();
            // TODO: set fonts
            p.setLayout(new FlowLayout(FlowLayout.LEADING));
            p.add(new JLabel(String.format("%.3f", r.time / 1000000000.0)));
            p.add(new JLabel(Integer.toString(r.miss)));
            p.add(new JLabel(r.keyboardLayout));
            p.add(new JLabel(r.username));
            p.add(new JLabel(DateFormat.getInstance().format(r.date)));

            recordsPanel.add(p);
        }
    }
}

@@ -45,32 +45,54 @@
 awt.FlowLayout;%0A
+import java.awt.Font;%0A
 import java.text
@@ -405,16 +405,87 @@
 Panel();
+%0A    public static final Font font = new Font(%22Arial%22, Font.PLAIN, 20);
 %0A%0A    pu
@@ -1041,24 +1041,25 @@
 lRecords();%0A
+%0A
         for 
@@ -1067,16 +1067,21 @@
 Record r
+ecord
  : recor
@@ -1109,17 +1109,25 @@
  JPanel 
-p
+oneRecord
  = new J
@@ -1151,40 +1151,17 @@
     
-// TODO: set fonts%0A            p
+oneRecord
 .set
@@ -1200,24 +1200,25 @@
 .LEADING));%0A
+%0A
             
@@ -1217,33 +1217,62 @@
         
-p.add(new JLabel(
+String%5B%5D recordString = %7B%0A                    
 String.f
@@ -1286,16 +1286,21 @@
 %25.3f%22, r
+ecord
 .time / 
@@ -1312,19 +1312,17 @@
 00000.0)
-));
+,
 %0A       
@@ -1326,33 +1326,24 @@
         
-p.add(new JLabel(
+        
 Integer.
@@ -1356,18 +1356,29 @@
 ng(r
+ecord
 .miss)
-));%0A
+,%0A        
     
@@ -1385,34 +1385,59 @@
         
-p.add(new JLabel(r
+record.username,%0A                    record
 .keyboar
@@ -1443,19 +1443,17 @@
 rdLayout
-));
+,
 %0A       
@@ -1461,110 +1461,259 @@
     
-p.add(new JLabel(r.username));%0A            p.add(new JLabel(DateFormat.getInstance().format(r.date)));
+        DateFormat.getInstance().format(record.date),%0A            %7D;%0A            for (String str : recordString) %7B%0A                JLabel label = new JLabel(str);%0A                label.setFont(font);%0A                oneRecord.add(label);%0A            %7D
 %0A%0A  
@@ -1739,17 +1739,25 @@
 nel.add(
-p
+oneRecord
 );%0A     

Change font when showing the list of records in the RecordsWindow