NTNUJAVA Virtual Physics LaboratoryEnjoy the fun of physics with simulations! Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
September 28, 2020, 12:37:12 am

Know yourself. Questioning. ...Socrates (469-399 BC)

 Pages: [1]   Go Down
 Author Topic: can the interface - field - format show special characters like alpha  (Read 20649 times) 0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
lookang
Hero Member

Offline

Posts: 1796

http://weelookang.blogspot.com

 « Embed this message on: August 13, 2007, 08:40:38 am » posted from:Singapore,,Singapore

hihi,

please advise how can i get the symbol alpha to display under the format of a field 2.0.

original result it shown as

i keyed in the α into the format, before compling looks correct

after compling, a ? appears in place of α

thanks for helping
 « Last Edit: August 13, 2007, 08:50:16 am by lookang » Logged
lookang
Hero Member

Offline

Posts: 1796

http://weelookang.blogspot.com

 « Embed this message Reply #1 on: August 13, 2007, 08:55:07 am » posted from:Singapore,,Singapore

attached is my xml.

thanks!
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #2 on: August 13, 2007, 12:10:23 pm »

It works on my computer. May be your computer did not support such font?
Please check out the attached file.
 alpha.png (59.74 KB, 509x344 - viewed 430 times.)  alpha.png (55.56 KB, 507x345 - viewed 435 times.)  alpha2.png (18.91 KB, 316x336 - viewed 442 times.) Logged
lookang
Hero Member

Offline

Posts: 1796

http://weelookang.blogspot.com

 « Embed this message Reply #3 on: August 13, 2007, 12:42:20 pm » posted from:Singapore,,Singapore

interesting!!!

i will try at home later.

by the way, can i download your  xml file to see if it works on this pc

thanks
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #4 on: August 13, 2007, 01:28:31 pm »

File is attached!
 *** There are 1 more attached files. You need to login to acces it! Logged
lookang
Hero Member

Offline

Posts: 1796

http://weelookang.blogspot.com

 « Embed this message Reply #5 on: August 13, 2007, 01:39:44 pm » posted from:Singapore,,Singapore

i am in a dilemma.

I think the problem is the pc here.

the alpha (in your system) is display as some funny thing (pound sign and a stroke) on this pc.

I will try to sort things out on my end.

 « Last Edit: August 13, 2007, 01:42:41 pm by lookang » Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #6 on: August 13, 2007, 02:31:35 pm »

It is related to character coding system used in the operating system.
Because I used Chinese operating system, the character code is not unisersal for those special characters(fonts).
Unless it was translated into UTF-8 code, otherwise, you would not be able to see it correctly.

 Logged
lookang
Hero Member

Offline

Posts: 1796

http://weelookang.blogspot.com

 « Embed this message Reply #7 on: August 13, 2007, 11:19:19 pm » posted from:Singapore,,Singapore

i tried using TT fonts , seems to work.

the closest match the alpha i can find is this one.

don't seems to work if i use those O fonts on the interface text field.

any tips ?
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #8 on: August 13, 2007, 11:22:25 pm »

I do not understand what do you mean by
"using TT fonts, seems to work. ... don't seems to work if i use those O fonts on the interface text field."
 Logged
lookang
Hero Member

Offline

Posts: 1796

http://weelookang.blogspot.com

 « Embed this message Reply #9 on: August 13, 2007, 11:29:16 pm » posted from:Singapore,,Singapore

i was experiment with true type fonts TT, the pound sign work!!, then i tried others, seems to work

i previously tried those with O , because alpha symbol is from say times news roman. It seems the text field can't recognise the true alpha symbol in java text field.

am i on the right track ?

the pictures may explain what is O(not sure what it means) and TT(true type)
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #10 on: August 14, 2007, 12:02:33 am »

I found out how to make it from the web search.
The String value for alpha is "\u03B1"

So if you define s="\u03B1=2.3"; as a variable in the ejs model and asign s to variable for text field
It should display as what you want. Please check out the attached file.
And it should work for all the operating system.

You can find the unicode for other characters from Unicode Character Search
 *** There are 1 more attached files. You need to login to acces it! Logged
lookang
Hero Member

Offline

Posts: 1796

http://weelookang.blogspot.com

 « Embed this message Reply #11 on: August 14, 2007, 12:31:34 am » posted from:Singapore,,Singapore

thanks for help.

i understand the idea about making it to strings.

but i think i do it for the plotting panel only.

EJS keep hanging on me when i tried to change the field_old 1.0 to take the string.

appreciate the help, this idea i going to use it on the plotting panel to show the angle with a polygon.

my next design improvement
 Logged
lookang
Hero Member

Offline

Posts: 1796

http://weelookang.blogspot.com

 « Embed this message Reply #12 on: August 14, 2007, 07:45:58 am » posted from:Singapore,,Singapore

i did it!!

thanks prof hwang for the idea of using text field , i horizontal box with the field.

in the variable for text field %alphasymbol%

alphasymbol is defined as a string in the declaration as "\u03B1"

BTW

my xml file is getting big ~100 kb, soon i will be unable to upload the xml here.
 Logged
lookang
Hero Member

Offline

Posts: 1796

http://weelookang.blogspot.com

 « Embed this message Reply #13 on: August 14, 2007, 07:56:22 am » posted from:Singapore,,Singapore

supporting pictures of what i meant.

for the rest learning from forum.
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #14 on: August 14, 2007, 01:02:05 pm » posted from:Taipei,T'ai-pei,Taiwan

thanks for help.

i understand the idea about making it to strings.

but i think i do it for the plotting panel only.

EJS keep hanging on me when i tried to change the field_old 1.0 to take the string.

appreciate the help, this idea i going to use it on the plotting panel to show the angle with a polygon.

my next design improvement

You should be able to use the same technique for the textString GUI element (to be added into the PlottingPanel).
Check out the EjsConsole, it will provide information about run time error to know why the ejs was hanging.
 Logged
lookang
Hero Member

Offline

Posts: 1796

http://weelookang.blogspot.com

 « Embed this message Reply #15 on: December 04, 2008, 10:46:25 am » posted from:SINGAPORE,SINGAPORE,SINGAPORE

found another way to draw symbol in EJS thanks to http://www.compadre.org/OSP/document/ServeFile.cfm?ID=8243&DocID=881 Rocket Car on an Inclined Plane Model
written by Wolfgang Christian, Francisco Esquembre, and Mario Belloni

I look at the source code and realise how they implement:

Quote
$\\beta$
by changing beta to gamma , alpha , theta

interesting huh?

BTW the text $\\beta$
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3085

 « Embed this message Reply #16 on: December 04, 2008, 04:55:28 pm » posted from:Taipei,T'ai-pei,Taiwan

It is because this forum will display mathematic equation if you put some TeX syntax between dollar sign.
For example:
$\alpha+ \beta +\Gamma$
will display
$\alpha+ \beta +\Gamma$
(It is similar to what will be display in EJS when you type equations in TeX format.  Because EJS code was compiled with java , so you need to add two backslashes to translate into one backslashes during the java string processing.)

You can also use _ and ^ to get subscript and superscript effect (and many more TeX mathematic equation features.)

If you want to display dollar sign, please add a backslash in front of dollar sign.
\\$
 Logged
lookang
Hero Member

Offline

Posts: 1796

http://weelookang.blogspot.com

 « Embed this message Reply #17 on: December 04, 2008, 05:10:51 pm » posted from:Singapore,,Singapore

that's cool! will try next time!
 Logged
 Pages: [1]   Go Up
Know yourself. Questioning. ...Socrates (469-399 BC)