can JButton text span a line?

Discussion in 'Java' started by Cloud Burst, Dec 15, 2003.

  1. Cloud Burst

    Cloud Burst Guest

    I want a JButton that looks something like this:

    ----------
    | Line 1 |
    | Line 2 |
    ----------

    I DO NOT want to use an image, just text.

    I tried:

    JButton jb = new JButton("Line 1\nLine 2");

    ....but all I get is this:

    ----------------
    | Line 1Line 2 |
    ----------------

    Is there a way to do this?

    Am I missing something obvious?

    Should I use some other component?

    Thanks.
    Cloud Burst, Dec 15, 2003
    #1
    1. Advertising

  2. "Cloud Burst" <> wrote in message
    news:...
    > I want a JButton that looks something like this:
    >
    > ----------
    > | Line 1 |
    > | Line 2 |
    > ----------
    >
    > I DO NOT want to use an image, just text.
    >
    > I tried:
    >
    > JButton jb = new JButton("Line 1\nLine 2");


    JButton jb = new JButton("<html><body>Line 1<br>Line 2</body></html>");

    HTH

    --
    Andrew Thompson
    * http://www.PhySci.org/ PhySci software suite
    * http://www.1point1C.org/ 1.1C - Superluminal!
    * http://www.AThompson.info/andrew/ personal site
    Andrew Thompson, Dec 15, 2003
    #2
    1. Advertising

  3. Cloud Burst

    Cloud Burst Guest

    On Mon, 15 Dec 2003 06:35:48 GMT, "Andrew Thompson" <> wrote:

    >"Cloud Burst" <> wrote in message
    >news:...
    >> I want a JButton that looks something like this:
    >>
    >> ----------
    >> | Line 1 |
    >> | Line 2 |
    >> ----------
    >>
    >> I DO NOT want to use an image, just text.
    >>
    >> I tried:
    >>
    >> JButton jb = new JButton("Line 1\nLine 2");

    >
    > JButton jb = new JButton("<html><body>Line 1<br>Line 2</body></html>");
    >
    >HTH


    ID!

    Thanks.
    Cloud Burst, Dec 15, 2003
    #3
  4. Cloud Burst

    Alex Hunsley Guest

    Cloud Burst wrote:
    > I want a JButton that looks something like this:
    >
    > ----------
    > | Line 1 |
    > | Line 2 |
    > ----------
    >
    > I DO NOT want to use an image, just text.
    >
    > I tried:
    > [snip]


    It's always worth looking on google groups.
    This one's been answered hundreds of times over:

    http://makeashorterlink.com/?A59E35FC6

    alex
    Alex Hunsley, Dec 15, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fulio Open

    Can span include span?

    Fulio Open, Jun 26, 2009, in forum: HTML
    Replies:
    5
    Views:
    535
    dorayme
    Jun 26, 2009
  2. Stéphane Klein
    Replies:
    2
    Views:
    1,735
    John Nagle
    Mar 30, 2010
  3. Stefan Behnel
    Replies:
    0
    Views:
    475
    Stefan Behnel
    Mar 29, 2010
  4. Dan Bishop

    DataGrid (body only) contained in <span>...</span> tags

    Dan Bishop, Jun 7, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    262
    Kilic Beg
    Jun 7, 2004
  5. Wang, Jay
    Replies:
    5
    Views:
    456
    Wang, Jay
    May 25, 2004
Loading...

Share This Page