Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Multiline Button  RSS feed

 
Meghna ks
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I wanted to know how multiple lines can be wrapped inside a button with the button's size being unchanged. I did go thro' the HTML way of doing this. But is there any other way apart from using HTML tags to do this ?!!
Thanks
Meghna
 
Swamy Vatti
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way to get around this is to add labels to the button. Looks something like this.
public class MultiLineButton extends javax.swing.JButton {
public MultiLineButton(String[] array) {
super();
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
for (int i = 0; i < array.size, i++) {
this.add(new JLabel(array[i]));}
}
}
or if u can parse the string with some delimiter, the parameter can be a string...I have tried this and works fine. but let me know how it works in urs...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!