• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JOptionPane String formatting

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm new to java and I am trying to get a table like display with JOptionPane.
the code I have is:

str = String.format(str + " %d \t %.0f \t %1.0f \t %d \n",count,qty,demand,inv);

JOptionPane.showMessageDialog(null,str,"Weekly Stats",JOptionPane.INFORMATION_MESSAGE);

the output im getting ignores the \t so everythiong is just crammed in next to each other. I was wondering of there is a different way to format the string to display in a table form.
I'm only allowed to use on method (main) and not allowed to use arrays.

Thank you all in advance
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was able to do it with inspiration from this: USING HTML IN SWING COMPONENTS.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic