Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

multiline text on button- urgent

 
charol kite
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
ravindran shanmugam
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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

[This message has been edited by ravindran shanmugam (edited August 30, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic