<commit_before>package ru.nsu.ccfit.bogolepov.tetris.view;

import ru.nsu.ccfit.bogolepov.tetris.event.Event;
import ru.nsu.ccfit.bogolepov.tetris.event.EventQueue;
import ru.nsu.ccfit.bogolepov.tetris.model.Field;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Observable;
import java.util.Observer;


public class TetrisView extends JFrame implements ActionListener {
    private FieldView fieldView;
    private FieldView previewView;
    private EventQueue eventQueue;
    private Timer timer;

    public TetrisView(Field field, Field preview, EventQueue eventQueue) {
        this.eventQueue = eventQueue;

        fieldView = new FieldView(field);
        field.addObserver(new FieldObserver(fieldView));

        previewView = new FieldView(preview);
        preview.addObserver(new FieldObserver(previewView));
        add(previewView);
        add(fieldView);
        setSize(200, 440);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setFocusable(true);
        timer = new Timer(400, this);
        addKeyListener(new TetrisInputHandler(eventQueue));
    }<commit_msg>Added preview for next block<commit_after>package ru.nsu.ccfit.bogolepov.tetris.view;

import ru.nsu.ccfit.bogolepov.tetris.event.Event;
import ru.nsu.ccfit.bogolepov.tetris.event.EventQueue;
import ru.nsu.ccfit.bogolepov.tetris.model.Field;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Observable;
import java.util.Observer;


public class TetrisView extends JFrame implements ActionListener {
    private FieldView fieldView;
    private FieldView previewView;
    private EventQueue eventQueue;
    private Timer timer;

    public TetrisView(Field field, Field preview, EventQueue eventQueue) {
        this.eventQueue = eventQueue;

        fieldView = new FieldView(field);
        fieldView.setSize(200, 440);
        field.addObserver(new FieldObserver(fieldView));

        previewView = new FieldView(preview);
        previewView.setSize(100, 100);
        preview.addObserver(new FieldObserver(previewView));

        JPanel gamePanel = new JPanel();
        gamePanel.setLayout(new BoxLayout(gamePanel, BoxLayout.LINE_AXIS));

        gamePanel.add(fieldView);
        gamePanel.add(previewView);
        add(gamePanel);
        setSize(300, 440);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setFocusable(true);
        timer = new Timer(400, this);
        addKeyListener(new TetrisInputHandler(eventQueue));
    }
{'fraction_non_alphanumeric': 0.09477379095163807, 'fraction_numerical': 0.01170046801872075, 'mean_word_length': 3.7150735294117645, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5453710', 'n_tokens_mistral': 812, 'n_tokens_neox': 760, 'n_words': 152}