• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Esmaeil Ashrafi
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • 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]
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic