can JButton text span a line?

C

Cloud Burst

I want a JButton that looks something like this:

----------
| Line 1 |
| Line 2 |
----------

I DO NOT want to use an image, just text.

I tried:

JButton jb = new JButton("Line 1\nLine 2");

....but all I get is this:

----------------
| Line 1Line 2 |
----------------

Is there a way to do this?

Am I missing something obvious?

Should I use some other component?

Thanks.
 
A

Andrew Thompson

Cloud Burst said:
I want a JButton that looks something like this:

----------
| Line 1 |
| Line 2 |
----------

I DO NOT want to use an image, just text.

I tried:

JButton jb = new JButton("Line 1\nLine 2");

JButton jb = new JButton("<html><body>Line 1<br>Line 2</body></html>");

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top