Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Displaying the text on jButton, new Lines  RSS feed

 
Cillian O'Mook
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Heya,


I have a variable called listAsString that holds an 8 x 4 list of numbers.
But if I try and create a jButton with this text it ignores the newLine, and just prints them away mad in a line.



Is there a way to alter this? either displaying the text as the variable holds it,
or setting boundaries so that the text will skip to the next line when it hits the side of the button

I want this (in my button):



But i'm getting this:



Any help appreciated.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Cillian,
Welcome to the Ranch.

JButton can render HTML.
You can get the desired result by using something like <HTML>1 2 3 4 5<P>6 7 8 9 9 instead of new line.
 
Cillian O'Mook
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

I don't want to hard code in the numbers, so im storing each line of numbers in a String line1, line2, line3, line4.
So can I use line breaks in between the inserting of each line (line1,etc..)

For instance:



Clearly this doesn't work, but maybe you can see what I want to accomplish?


Any help is greatly appreciated, thank you.



edit//.

it worked with this: (obvious, but hey)

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!