Exception in thread "main" java.lang.NullPoin

Bonjour,

public class Tetris extends JFrame {

    JLabel Container;
    
     public Tetris() {

        Container pane = getContentPane();
        pane.setLayout(new BorderLayout());
        pane.add(getHeader(), BorderLayout.NORTH);
        pane.add(getTextArea(), BorderLayout.CENTER);
        Container.setPreferredSize(new Dimension(125, 100));
        Board board = new Board(this);
        board.setBackground(Color.white);
        add(board);
        board.start();

        setSize(400, 600);
        setTitle("Tetris");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
   }

   public JLabel getContainer() {
       return Container;
   }
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Tetris game = new Tetris();
        game.setLocationRelativeTo(null);
        game.setVisible(true);
    }

    private Component getHeader() {
            JLabel label = new JLabel("Score : " + "0", JLabel.CENTER);
            label.setFont(new Font("Comic sans ms", Font.BOLD, 20));
            return label;
    }

    private Component getTextArea() {
        return new JTextArea(50, 50);
    }
}

1 réponse

  • Votes
  • Date
  • Date décroissante