Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:
JavaWorld Daily Brew

HTML rendering in Swing is possible!

Back to:
www.javaworld.com/javaworld/javaqa/2000-03/01-qa-button.html
.

You can even modify text alignment:

JButton myButton = new JButton("

Hello
World

");

Your rating: None

Thx dude

This is a great idea!

b.setLayout(new BorderLayout());
JLabel label1 = new JLabel("Your");
JLabel label2 = new JLabel("Name");
b.add(BorderLayout.NORTH,label1);
b.add(BorderLayout.SOUTH,label2);

thx

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <p> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <br /> <br> <strike>
  • Lines and paragraphs break automatically.
  • Use <!--pagebreak--> to create page breaks.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

CAPTCHA
Just checking to see if you're an actual person rather than a spammer. Sorry for the inconvenience.