Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > can JButton text span a line?

Reply
Thread Tools

can JButton text span a line?

 
 
Cloud Burst
Guest
Posts: n/a
 
      12-15-2003
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.
 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      12-15-2003
"Cloud Burst" <> wrote in message
news:...
> 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

--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site


 
Reply With Quote
 
 
 
 
Cloud Burst
Guest
Posts: n/a
 
      12-15-2003
On Mon, 15 Dec 2003 06:35:48 GMT, "Andrew Thompson" <> wrote:

>"Cloud Burst" <> wrote in message
>news:.. .
>> 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


ID!

Thanks.
 
Reply With Quote
 
Alex Hunsley
Guest
Posts: n/a
 
      12-15-2003
Cloud Burst wrote:
> 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:
> [snip]


It's always worth looking on google groups.
This one's been answered hundreds of times over:

http://makeashorterlink.com/?A59E35FC6

alex

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I'm looking for html cleaner. Example : convert <h1><span><font>my title</font></span></h1> => <h1>my title</h1>… Stéphane Klein Python 2 03-30-2010 12:35 AM
Re: I'm looking for html cleaner. Example : convert <h1><span><font>my title</font></span></h1> => <h1>my title</h1>… Stefan Behnel Python 0 03-29-2010 08:14 PM
Can span include span? Fulio Open HTML 5 06-26-2009 10:24 PM
DataGrid (body only) contained in <span>...</span> tags Dan Bishop ASP .Net Datagrid Control 2 06-07-2004 04:00 PM
Enable drag and drop to the text between <span></span> Wang, Jay Javascript 5 05-25-2004 09:33 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57