I have 3 Arrays
of TextList
and everytime a button is pressed, the text will appear one after another. However, The next text appears beside the previous text. I would like the next text to appear below instead. I tried using <html>
and <p>
but instead they appear with the text. How do i make the text to appear below instead of beside each other?
This is my sample of code.
textList.add("<html> Testing");
textList.add("<p> asdasdssss<p>ssssssssssssa<p>dssad");
textList.add("\n lmaoasdasasd" + "</html>");
JLabel hint = new JLabel("");
hint.setBounds(29, 21, 395, 134);
panel.add(hint);
JButton btnHint = new JButton("hint");
btnHint.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
hint.setText(hint.getText() + "\n" + textList.get(textIndex++));
}
});
, \n,
– Rui Isolet Feb 01 '17 at 10:48tags in my textList strings but they appear with the string instead.