• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Why the result of printing out the not-letter chars to console is different from to applets

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi dear friends;
Once upon a time i wrote a program just to being trained with complicated loops.I write it perfect and the question i am asking is not a real problem, however i like to discuss about that with you professionals and would be very happy if find a good explanation (even a small one )
I will paste two program code that do the same and are almost same, except that one is uses a JApplet (no matter if an Applet) and another uses standard output to print the result.
Please, don't be angry if understanding the code would be difficult (it is also difficult to me now ), because it's not the matter and you can see the results from images i attached.

The programs:

this one uses console output and does perfect in formatting

second one:

this one can not align well !

Thanks for your care and have a brilliant day
applet-result.PNG
[Thumbnail for applet-result.PNG]
console-result.PNG
[Thumbnail for console-result.PNG]
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Consoles almost always use monospaced fonts (where the space and the asterisk have the same width), while the default GUI font is a proportional font (where they do not). Have the applet use a monospaced font such as Courier, and it'll work.
 
Esmaeil Ashrafi
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
W0W

that was great, the best, fastest, simplest, most perfect answer i ever got !

that worked just as you said,thank you very much
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic