0

I have a few records of data (less then 10). Each record consists of a few lines of text. I want to present records to the user in a kind of grid, where user can select one of the records.

I was thinking about List component or jTable, but I couldn't make them displaying more then one line of text. What component should I use then, or how to approach this?

In subject I suggested AWT because size does matter, i.e. I want use this functionality in the applet and would like to avoid any extra libraries.

Thanks in advance

norbi771
  • 814
  • 2
  • 12
  • 29

1 Answers1

0

Thanks to maksimov's link I found examples of how to tackle this issue, and also very interesting link I missed somehow - http://docs.oracle.com/javase/tutorial/uiswing/components/html.html

To specify that a component's text has HTML formatting, just put the tag at the beginning of the text, then use any valid HTML in the remainder. Here is an example of using HTML in a button's text:

button = new JButton("<html><b><u>T</u>wo</b><br>lines</html>");

In my case it was just enough to set height of the row and add tag just before string data to be displayed. HTML tagging also let me use extra formatting, colors, etc,

Brilliant,

Thank you maksimiov

norbi771
  • 814
  • 2
  • 12
  • 29