• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

multiline text on button- urgent

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
 
reply
    Bookmark Topic Watch Topic
  • New Topic