jQuery in Action, 3rd edition
The moose likes Swing / AWT / SWT and the fly likes multiline text on button- urgent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "multiline text on button- urgent" Watch "multiline text on button- urgent" New topic

multiline text on button- urgent

charol kite

Joined: Aug 24, 2001
Posts: 2
I/m posting this topic again.I need a button to have label on diff lines(like say click and here on 2 lines).Its possible with swing if I use html tag etc but in my architecture I cannot use swing components.
can I use couple of awt components and give the look and function of button and work it out
Thanks for the help
Vinod Venugopal
Ranch Hand

Joined: Dec 06, 2000
Posts: 148
If you would have used Swing buttons then you could have added 2 labels to it made it look like a multiline one. Or you can create your own custom JButton by extending JButton and overriding its paint method. In that method, you would tokenize your string based on \n, do a few spacing calculations, draw your button, and then draw your broken text.
For AWT ,maybe you could use 2 textfields, make them editable(false) & stuff, play with the borders & make it look like a button, then its possible.

- Vinod<br />-------<br />SCJP2
ravindran shanmugam

Joined: Aug 30, 2001
Posts: 15

Try this
JButton jb = new JButton("< HTML > Hello < BR > World < /HTML >");

[This message has been edited by ravindran shanmugam (edited August 30, 2001).]
I agree. Here's the link: http://aspose.com/file-tools
subject: multiline text on button- urgent
It's not a secret anymore!