aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Why the result of printing out the not-letter chars to console is different from to applets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Why the result of printing out the not-letter chars to console is different from to applets " Watch "Why the result of printing out the not-letter chars to console is different from to applets " New topic
Author

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

Esmaeil Ashrafi
Ranch Hand

Joined: Feb 22, 2010
Posts: 73
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


[Thumbnail for applet result.PNG]

[Thumbnail for console result.PNG]



I'm really tired of being engaged with stuff other than Java and programming

Wish to get back soon to my love...
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41574
    
  54
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.


Ping & DNS - my free Android networking tools app
Esmaeil Ashrafi
Ranch Hand

Joined: Feb 22, 2010
Posts: 73
W0W

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

that worked just as you said,thank you very much
 
jQuery in Action, 2nd edition
 
subject: Why the result of printing out the not-letter chars to console is different from to applets