Monday Mar 30, 2009

JavaFX 编程大赛开始了!

具体内容参考这里:http://www.javafx.com/challenge/

奖金丰厚,可惜,Sun 公司职员不能参加 :-(



Friday Mar 06, 2009

Other language for Japanese, Chinese is also avaliable.

Please check here for Korean: http://www.javafx.com/ko/

You can change the language from the right bottom of the website.

Thursday Dec 18, 2008

上次讲到在Mac 操作系统中显示 字体有一些问题, 这次 我们试试用几种办法解决这个问题。

1. 在 JavaFX脚本中 显示字体

不用缺省值,而显式地指定字体.

把原来的代码段:

===================================================
SwingLabel {height: 30 width: 250 text: v1},
SwingLabel {height: 30 width: 250 text: v2},
SwingLabel {height: 30 width: 250 text: v3},
SwingButton {height: 30 width: 250 text: v4},
SwingButton {height: 30 width: 250 text: v5}
===================================================

改成

===================================================
SwingLabel {height: 30 width: 250 text: v1 font: Font{name: "MS Gothic", size: 20}},
SwingLabel {height: 30 width: 250 text: v2 font: Font{name: "MS Gothic", size: 20}},
SwingLabel {height: 30 width: 250 text: v3 font: Font{name: "MS Gothic", size: 20}},
SwingButton {height: 30 width: 250 text: v4 font: Font{name: "MS Gothic", size: 20}},
SwingButton {height: 30 width: 250 text: v5 font: Font{name: "MS Gothic", size: 20}}
===================================================

字体的大小变大了,结果是:

 

 

但结果是 这种方法 会让javafx脚本 不具备通用性了- 不同的语言需要不同的字体类型。

这里有更好的办法解决这个问题 -感谢 Naoto-san的帮助! 

 

2. 在JavaFX脚本中 设置系统缺省值 Look and Feel

这里我在脚本中指定 Look and Feel (aka LAF)到系统的缺省值。

LAF缺省值是javax.swing.plaf.metal.MetalLookAndFeel. 但是在MacOS中我们最好指定它自己的LAF: apple.laf.AquaLookAndFeel.

在任何情况下,下面的代码是一个比较巧妙的方法。 

===================================================
var dLAF = UIManager.getSystemLookAndFeelClassName();
UIManager.setLookAndFeel(dLAF);
===================================================

别忘了用 import加入 UIManager class, 并把刚才设置的字体变回缺省值。

===================================================
import javax.swing.UIManager;
===================================================

 

下面是执行结果:

 

看着舒服多了吧!

附 - 这个问题已经被报告: Swing based FX apps look worse comparing to the Swing native apps on MacOSX.

如果你觉得需要解决这个bug,请对它投票吧!

Wednesday Dec 17, 2008

JavaFX 本地化可以说简单方便,下面的介绍是从Naoko-san的blog中参考而来的.谢谢Naoko!

第一步,创建应用程序:

下面是应用程序的源代码,值得注意的是那些字符串,另外放到外部的.

===================================================
import javafx.stage.Stage;
import javafx.scene.*;
import javafx.scene.text.Font;

import javafx.ext.swing.*;
import javafx.scene.layout.VBox;

var v1 = ##"My Label";
var v2 = ##"Your Label";
var v3 = ##"Our Label";
var v4 = ##"Hello Button";
var v5 = ##"Goodbye Button";

Stage {
    title: "JavaFX Localization Test"
    width: 300
    height: 300
    visible: true
    scene:
        Scene {
            content:
            VBox {
                spacing:5
                content: [
                    SwingLabel {height: 30 width: 250 text: v1},
                    SwingLabel {height: 30 width: 250 text: v2},
                    SwingLabel {height: 30 width: 250 text: v3},
                    SwingButton {height: 30 width: 250 text: v4},
                    SwingButton {height: 30 width: 250 text: v5}
                ]
            }
        }
}

===================================================
2.  编译并运行.

# javafxc test.fx
# javafx test

在Mac操作系统上的结果是:



3.  创建fxproperty 文件.

在这里我们输入翻译好的字符串.下面是test_zh_CN.fxproperties文件内容.我们可以看到文件里直接输入了
本地化的字符串,并不需要加密的换码顺序(encrypted escape sequences)!

===================================================
@charset "GBK";

"My Label" = "我的标签"
"Your Label" = "你的标签"
"Our Label" = "我们的标签"
"Hello Button" = "你好,按钮"
"Goodbye Button" = "再见按钮"
===================================================

4. 在中文winxp上执行,并输出结果.

 

在Mac操作系统中运行,结果:

 

 

在Mac OS上,字体会比较丑,这个问题我们下一次讨论.

Monday Apr 28, 2008

今天下午97分考过SCJP 310-055. 考试比想象得简单. 从考场出来如释重负, 总算几个月的努力没有白费一场.

也许有人认为这个考试简单,但是对我来说意义非常大. 通过近三个多月的准备和学习,我对JAVA的认识,几乎从零到上了一个台阶.

之所以决定考这门考试是有几个原因的.

1. 之前没有学过JAVA. 我比较熟悉的编程语言只有C/C++. 在创始JAVA的公司里,不会JAVA有点说不过去.

2.相关工作,也迫使我应该多熟悉JAVA.

3.领导支持,公司支持,呵呵(推出职工免费考认证的活动).

确定了目标, 就要准备迎战.虽然现在有了新的6.0考试,但是可以提供的复习资料不多, 所以选择了5.0.

经过网上一番搜索,  根据大家的推荐,我买了一本SCJP 学习指南(Sun Certified Programmer for Java 5)开始,拜读.

 第一次读这本书,将近花了一个月, 主要以理解为主, 虽然没有报太多希望,但是做完每一章的习题, 都会有一半以上的题,答错,有点灰心啊. 又要上班,又要照顾女儿, 半夜要起来几次喂奶,比较痛苦, 所以拖拖拉拉,用在学习的时间也不多.

真正进入学习状态是3月底开始, 重新仔细研究了每一章,牺牲了周末的休息日,还有几天年假. 看完书后,紧接着做了 随书附送的Master Exams. 又是一个打击, Master Exam 没有通过, 好在Master Exam里有,详细的解释, 看完后,好多地方豁然开朗.

重新再看了一遍书,这次速度比前两次,加快了,但是效率高,好多以前不明白的概念,第三次的时候,明白过来了,而且越看觉得越有意思. 书后的习题重新做一遍,然后在网上搜索了一个据说命中率很高的习题下来做了一遍. 还是好多地方答错了, 但是这回毕竟进步了不少.

开始进入了做习题的阶段. 我又在公司的网络课程上,找到了Java5.0的习题做了一遍. 最后考试之前,我对每份习题都至少做到了3遍以上(包括课后习题,Master Exams, 网上习题,公司内部习题). 后来觉得其实真正的收获不在于考试,而是利用这个机会,打好JAVA基础是值得的.

总的来说,我的复习资料是 SCJP学习指南和几个题库. 这本书确实不错,不但是非常棒的考试资料,而且也是很好的JAVA学习用书.不过我看的中文版本,有好几个地方有翻译错误,让我郁闷了半天,后来对照英语电子文档,才反应过来的, 还有网上找到的习题库,也确实是命中率很高的.

考完考试,我的感受多多, 其中一点是让我更加明白了如果努力, 并且不半途而废,最终都能达成目标的.

最后真的很感谢我的公公婆婆,如果没有他们照顾好我们家小朋友,我恐怕没有太多时间去复习.


 

Thursday Apr 10, 2008

  Today's table topic theme is  the most memorable gift you received.  The topic is around the gift you have received and sent.
Though I haven't give a talk in the table topic session, I can say now that I have received a wonderful gift today from one of my toastmaster officers.

He is a nice person, who always encourage me in the speech.
Even practice many times, I still can't overcome my nervousness in the speech.
So my third prepared speech, is not successful, and  I am a little upset.
But   many people encourage me, and they even said I did a good job, which make my heart warmed.

Thanks Paul and all my fellow toastmasters who always give me courage.
 
PS: Paul gave me a  toy gift, for the birth of my baby, very kind! :-)


 

 

Tuesday Mar 11, 2008

오늘 나의 멘토(mentor)와의 첫번째 대화의 시간을 가졌습니다. 

멘토 Anita는 나의 많은 질문에 대해 친절하게 대답해주었습니다.

우리의 대화는 즐거운 분위기에서  여러가지 토픽으로 잘  진행되었습니다.

So  I look forward to  talking  with  her next time.


 

Wednesday Feb 27, 2008

  These two days, I tried to install Soalrs10u4  on my virtualbox on my laptop. But unfortunately, I was failed.

The root reason I think is the configuration of my computer isn't sufficient. 

My computer has: 

                            Intel(R) Core(TM)2 CPU

                                 T5600 @183GHz

                             1.83GHz,1.00GBRAM

The installation was suspended several times with warning of low memory :-(

Saturday Feb 23, 2008

Yesterday, I installed virtualbox in my notebook. The installation and configuration are much simper than I think.

First, you should download virtualbox from here. And launch the installation. The installation is much simple and the size of virtual box itself is only about 30M.

After the installation is finished, do some configuration for installing your virtual machine as a guest. You can select default value for easiness. If the virtual machine is successfully resided in the host(your phisical machine), you should add virtual box additions for better use.

Here is the picture for my installation(windows 2000 pro on winxp).



 

Friday Dec 07, 2007

http://kr.opensolaris.org/

Tuesday Jun 05, 2007

Korean Identity Management(KIM)

 http://ayo79.egloos.com/

Here is simple steps of opensso.

1. Get the opensso nightly build from opensso site:
http://download.java.net/general/opensso/nightly/amserver/

2. Download opensso.war file and deploy it to the web container(Appserver8.2,Glassfish,Tomcat).
   Here, I deployed it to Appsrv8.2 through web console.

3. Restart web container. (It is required step, otherwise, configuration will be failed)

4. Goto http://hostname:8080/am. It will be automatically redirect to configuration page.

5. Fill the configuration data.

6. Login to opensso webpage: http://hostname:8080/am using amadmin. 

Thursday May 24, 2007

출처:http://www.copyeditor.co.kr/reference/char-font/johabwansung.htm