我想检查JLabel中有多少行。但是后来出了点问题,我无法在JLabel中换行。有人可以解释一下我在做什么错吗?
private void SetPlayersBoard() {
playersBoard = new JLabel("h <br/>");
playersBoard.setSize(400, 400);
playersBoard.setLocation(50,100);
playersBoard.setVisible(true);
this.add(playersBoard);
playersBoard.setOpaque(true);
repaint();
for(int i=0; i<20; i++)
playersBoard.setText(playersBoard.getText() + playersBoard.getText());
String myText = playersBoard.getText();
playersBoard.setText("<html>" + myText + "</html>");
}