I'm trying to make a list of texts that looks like this:
I have this code:
panelPunts = new JPanel();
panelPunts.setBackground(Color.GRAY);
biggerPanel.add(panelPunts, BorderLayout.EAST);
JLabel titol = new JLabel();
titol.setText("<html><h1><u> Points</u></h1></html>");
titol.setBounds(0, 0, 200, 50);
panelPunts.add(titol);
JLabel etnia1 = new JLabel();
etnia1.setText("Team A: 20");
etnia1.setBounds(0, 20, 200, 50);
panelPunts.add(etnia1);
JLabel etnia2 = new JLabel();
etnia2.setText("Team A: 10");
etnia2.setBounds(0, 40, 200, 50);
panelPunts.add(etnia2);
However, it looks like this:
I've read that the second parameter in the setBounds()
method is the Y position, however it doesn't change if I make it really high. Why doesn't it show properly?