Re: Unicode - UGLY GUI



ravi.k.sinha@xxxxxxxxx wrote:
I run the app with the following command line

java -Dfile.encoding="UTF-8" package.myClass

Doing this results in puffed up visual widgets, for e.g., the buttons
height is increased, the same for labels, fields, text area. All the
GUI looks totally bloated.

The file encoding - which is for file I/O - has nothing to do with what happens inside Java or the GUI. Java always used Unicode characters internally and for the GUI. Changing the file I/O encoding has no impact on the encoding used in Java or the GUI per-se.


There is something else going wrong in your code. Maybe you read data from a file which is later displayed. By changing the file encoding the data in the file gets already misinterpreted when it is read. You later display the data. Since it got misinterpreted when it was read it refers to other characters. These other characters might force the layout managers in the GUI to dynamically adapt the GUI to accommodate different character sizes.

Very likely there is nothing wrong in the GUI, and everything wrong in the way you do file I/O. It is already a bad idea to require that a file encoding needs to be specified on the command line. You could revise your code.

How can we correct this problem?

Follow this advice

<http://www.physci.org/codes/sscce.jsp>

and show us code demonstrating the problem. Not any code, but code which is in line with the above referred advice.

/Thomas

--
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
.