XML : JLabel. Proper way to setup text read from a xml file?

I'm reading a string from an xml file and stumbled across two problems. First the string dosen't containt html < br> for line breaking, so the JLabel is just one line. Second I'd like to make the JLabel fit in height according to the "size" of the text. below I sat the height of the JLabel to 200px, but if e.g there's just one word, the JLabel vertically and horizontally centers the text.

Am I missing some "easier" way to do this?

  String text = "some long string";    JLabel jltxt = new JLabel(text);  jltxt.setBounds(207, 5, 200, 200);    

No comments:

Post a Comment