java FX 的do语句

java FX 的do语句

脚本引擎终于可以工作了,一个小小的do语句解决了所有的问题。
 
FX可以调用java的类、方法,可是在调用时,却会出现莫名其妙的错误,例如:界面里有个按钮,其action的operation是调用某个外部类的某个方法,可是,脚本在运行时居然会首先执行operation的内容,而不是在点击按钮之后再执行。
 
解决这个问题的办法就是把你想要执行的语句嵌套在do语句大括号中。这样在初始化脚本时就不会执行了。
 
附上do的说明:
Do Statement
The F3 do statement allows you to execute a block of F3 code in a background thread while allowing the AWT Event Dispatch Thread to continue processing events, thereby preventing the UI from appearing to hang. Currently, this is implemented by using java.awt.EventQueue to pump events while the background thread is executing. Normally, all F3 code executes in the AWT Event Dispatch Thread. Only code contained in the body of a do statement is allowed to execute in another thread. Such code must only access Java objects (and those objects must handle their own thread synchronization, if necessary).

2 thoughts on “java FX 的do语句

  1. wow gold!All wow gold US Server 24.99$/1000G on sell! Cheap wow gold,wow gold,wow gold,Buy Cheapest/Safe/Fast WoW US EU wow gold Power leveling wow gold from the time you wWorld of Warcraft gold ordered!

    wow power leveling wow power leveling power leveling wow power leveling wow powerleveling wow power levelingcheap wow power leveling wow power leveling buy wow power leveling wow power leveling buy power leveling wow power leveling cheap power leveling wow power leveling wow power leveling wow power leveling wow powerleveling wow power leveling power leveling wow power leveling wow powerleveling wow power leveling buy rolex cheap rolex wow gold wow gold wow gold wow gold -44171347481700

  2. wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold
    wow gold -229727529470421

Leave a Reply

Your email address will not be published. Required fields are marked *