Tabs in JOptionPane window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • - Steve -

    Tabs in JOptionPane window

    Example

    String testString = "Testing \t tabs";

    JOptionPane.sho wMessageDialog( null, testString, "TEST",
    JOptionPane.INF ORMATION_MESSAG E);


    Instead of getting the output "Testing tabs", I get something more like
    "Testing | tabs" (although it isn't a pipe symbol, it's something unusual).

    What do you need to do to get tabs to work with JOptionPane windows?


  • SPG

    #2
    Re: Tabs in JOptionPane window

    I think you have to use a JLabel or JTextField to do this:

    JOptionPane.sho wMessageDialog( null, new JLabel(testStri ng), "TEST",
    JOptionPane.INF ORMATION_MESSAG E);


    "- Steve -" <sevans@foundat ion.sdsu.edu> wrote in message
    news:1yGmb.2910 2$B_2.26152@oke pread02...[color=blue]
    > Example
    >
    > String testString = "Testing \t tabs";
    >
    > JOptionPane.sho wMessageDialog( null, testString, "TEST",
    > JOptionPane.INF ORMATION_MESSAG E);
    >
    >
    > Instead of getting the output "Testing tabs", I get something more like
    > "Testing | tabs" (although it isn't a pipe symbol, it's something[/color]
    unusual).[color=blue]
    >
    > What do you need to do to get tabs to work with JOptionPane windows?
    >
    >[/color]


    Comment

    • - Steve -

      #3
      Re: Tabs in JOptionPane window

      Unfortantley that doesn't change the tab behavior and eliminated the
      functionality of the \n (everything is now on one line)

      Steve


      "SPG" <steve.goodsell @nopoo.blueyond er.co.uk> wrote in message
      news:bNVmb.2356 $ao6.23256326@n ews-text.cableinet. net...[color=blue]
      > I think you have to use a JLabel or JTextField to do this:
      >
      > JOptionPane.sho wMessageDialog( null, new JLabel(testStri ng), "TEST",
      > JOptionPane.INF ORMATION_MESSAG E);
      >
      >
      > "- Steve -" <sevans@foundat ion.sdsu.edu> wrote in message
      > news:1yGmb.2910 2$B_2.26152@oke pread02...[color=green]
      > > Example
      > >
      > > String testString = "Testing \t tabs";
      > >
      > > JOptionPane.sho wMessageDialog( null, testString, "TEST",
      > > JOptionPane.INF ORMATION_MESSAG E);
      > >
      > >
      > > Instead of getting the output "Testing tabs", I get something more[/color][/color]
      like[color=blue][color=green]
      > > "Testing | tabs" (although it isn't a pipe symbol, it's something[/color]
      > unusual).[color=green]
      > >
      > > What do you need to do to get tabs to work with JOptionPane windows?
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • SPG

        #4
        Re: Tabs in JOptionPane window

        OK,

        Try passing the text as HTML. IE Wrapping some tags around it. That worked
        for us by accident when we were reporting errors from an HTTP post once.

        If not, then use a JTextField or JTextArea, setting no border and the
        bgcolor the same as the dialog, and editable = false. These can handle tabs
        for sure!

        Steve
        "- Steve -" <sevans@foundat ion.sdsu.edu> wrote in message
        news:T22nb.3639 9$B_2.25477@oke pread02...[color=blue]
        > Unfortantley that doesn't change the tab behavior and eliminated the
        > functionality of the \n (everything is now on one line)
        >
        > Steve
        >
        >
        > "SPG" <steve.goodsell @nopoo.blueyond er.co.uk> wrote in message
        > news:bNVmb.2356 $ao6.23256326@n ews-text.cableinet. net...[color=green]
        > > I think you have to use a JLabel or JTextField to do this:
        > >
        > > JOptionPane.sho wMessageDialog( null, new JLabel(testStri ng), "TEST",
        > > JOptionPane.INF ORMATION_MESSAG E);
        > >
        > >
        > > "- Steve -" <sevans@foundat ion.sdsu.edu> wrote in message
        > > news:1yGmb.2910 2$B_2.26152@oke pread02...[color=darkred]
        > > > Example
        > > >
        > > > String testString = "Testing \t tabs";
        > > >
        > > > JOptionPane.sho wMessageDialog( null, testString, "TEST",
        > > > JOptionPane.INF ORMATION_MESSAG E);
        > > >
        > > >
        > > > Instead of getting the output "Testing tabs", I get something more[/color][/color]
        > like[color=green][color=darkred]
        > > > "Testing | tabs" (although it isn't a pipe symbol, it's something[/color]
        > > unusual).[color=darkred]
        > > >
        > > > What do you need to do to get tabs to work with JOptionPane windows?
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...