小编Vla*_*kov的帖子

在另一个线程中创建一个阶段时出现IllegalStateException

我在另一个线程中再打开一个阶段时遇到问题.如果我在同一个线程中打开此阶段,则不会出现异常.

void hashMapDeclaration(){
    actions2methods.put("NEW", new Runnable() {@Override public void run() { newNetCreation(); }});
    actions2methods.put("LOAD", new Runnable() {@Override public void run() { loadNetState(); }});
    ......  //other hashes
}

HBox buttonBuilder(double spacing,double layoutX,String... bNames){
    HBox lBar = new HBox(10);
    .... //some code
    for(final String text : bNames){ //in my case text variable value is "NEW" so it should run method newNetCreation
        Button newButton = new Button();
        newButton.setText(text);
        .... //code
        newButton.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent paramT) {
                Thread t;
                EventQueue.isDispatchThread();
                t …
Run Code Online (Sandbox Code Playgroud)

java user-interface javafx-2

3
推荐指数
1
解决办法
5039
查看次数

标签 统计

java ×1

javafx-2 ×1

user-interface ×1