Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2008
    Posts
    2
    Rep Power
    0

    Default How to wrap words in checkbox,push buttons

    Is it possible to wrap sentence thru 'checkbox.setText()?
    Basically i need to keep text of check box in 2 lines.
    if I do same thing in case of label --label.setText("Hello\nWorld").
    o/p--Hello
    World

    but in case of check box or push button i.e. chkbox.setText("Hello\nWorld");
    O/p---Hello[]World..

    Infact no escape sequence(\n,\f,\r etc) is working in any of the button case.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Did you try to use with HTML codes in the setText() function. I hope it support for HTML tags.

  3. #3
    SecretCode is offline Member
    Join Date
    Jun 2008
    Location
    South Africa
    Posts
    6
    Rep Power
    0

    Default

    HTML codes don't work.

    http : // dev.eclipse.org/newslists/news.eclipse.platform.swt/msg14885.html says wrapping is not supported on a button.

    You would be able to fake it with an image, or you might be able to able to override it with a paint listener (but I have a feeling that at least on Windows the native button object does not support custom painting).

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. How to create tool bar (wrap on resize)
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-02-2008, 08:10 PM
  2. How to use ItemListener for CheckBox class
    By Java Tip in forum javax.swing
    Replies: 0
    Last Post: 04-23-2008, 08:18 PM
  3. Stack push/pop/peek operations
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-29-2008, 09:03 AM
  4. SWT push button
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-31-2007, 01:21 PM
  5. checkbox
    By Alan in forum AWT / Swing
    Replies: 3
    Last Post: 05-18-2007, 10:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •