使用setTimeout使用javascript关闭窗口

时间:2016-07-20 04:09:08

标签: vaadin7

点击按钮创建一个窗口,添加到UI,我想用javascript关闭这个窗口?请建议如何在超时后使用javascript关闭此窗口?

Button  button= new Button("load Content",e->{
        Window  sub= new Window();
        UI.getCurrent().addWindow(sub);
    });

1 个答案:

答案 0 :(得分:1)

试试这个:

JSONObject parameters = new JSONObject();
    try {

        parameters.put("f_name", "name1");
        parameters.put("l_name", "name2");
        .......


    }catch (Exception e){
        e.printStackTrace();
    }

    AppJSONObjectRequest objectRequest = new AppJSONObjectRequest(Request.Method.PUT, url, parameters, RequestSuccessListener, RequestErrorListener, getHeaders); //headers if u have
    //url: your request base url

    VolleySingleton volleySingleton = VolleySingleton.getInstance(this);
    volleySingleton.addToRequestQueue(objectRequest);

//这里5000毫秒是指5秒