Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 为什么建议列表在GWT中仍然可见_Java_Gwt_Smartgwt_Suggestbox - Fatal编程技术网

Java 为什么建议列表在GWT中仍然可见

Java 为什么建议列表在GWT中仍然可见,java,gwt,smartgwt,suggestbox,Java,Gwt,Smartgwt,Suggestbox,我正在gwt中使用建议框,并将SelectionHandler和onFocusHandler添加到建议框中,但选择后建议列表仍然可见。。但事实并非如此 选择一个建议后,我应该如何隐藏建议列表 suggestBox.getValueBox().addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { if(suggestBox.

我正在gwt中使用建议框,并将SelectionHandler和onFocusHandler添加到建议框中,但选择后建议列表仍然可见。。但事实并非如此

选择一个建议后,我应该如何隐藏建议列表

suggestBox.getValueBox().addFocusHandler(new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
            if(suggestBox.getText().equals("")){
                suggestBox.setText(" ");
                suggestBox.showSuggestionList();
                suggestBox.setText("");
            }   
        }
    });

suggestBox.addSelectionHandler(new SelectionHandler<SuggestOracle.Suggestion>() {

        @Override
        public void onSelection(SelectionEvent<Suggestion> arg0) {
            if (arg0.getSelectedItem() instanceof Suggestion) {
                //code to take actions after selection
            }
        }
    });
suggestBox.getValueBox().addFocusHandler(新的FocusHandler(){
@凌驾
公众焦点无效(焦点事件){
if(suggestBox.getText().equals(“”){
suggestBox.setText(“”);
showSuggestionList();
suggestBox.setText(“”);
}   
}
});
suggestBox.addSelectionHandler(新的SelectionHandler(){
@凌驾
选择时公共无效(SelectionEvent arg0){
if(arg0.getSelectedItem()建议实例){
//选择后执行操作的代码
}
}
});
选择其中一项后,我应该如何隐藏建议列表 建议

suggestBox.getValueBox().addFocusHandler(new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
            if(suggestBox.getText().equals("")){
                suggestBox.setText(" ");
                suggestBox.showSuggestionList();
                suggestBox.setText("");
            }   
        }
    });

suggestBox.addSelectionHandler(new SelectionHandler<SuggestOracle.Suggestion>() {

        @Override
        public void onSelection(SelectionEvent<Suggestion> arg0) {
            if (arg0.getSelectedItem() instanceof Suggestion) {
                //code to take actions after selection
            }
        }
    });
为什么不在选择处理程序中隐藏列表

    @Override
    public void onSelection(SelectionEvent<Suggestion> arg0) {
        if (arg0.getSelectedItem() instanceof Suggestion) {
            //code to take actions after selection
        }
        DefaultSuggestionDisplay display = (DefaultSuggestionDisplay) suggestBox.getSuggestionDisplay();
        display.hideSuggestions();
    }
@覆盖
选择时公共无效(SelectionEvent arg0){
if(arg0.getSelectedItem()建议实例){
//选择后执行操作的代码
}
DefaultSuggestionDisplay=(DefaultSuggestionDisplay)suggestBox.getSuggestionDisplay();
display.hideSuggestions();
}

通过添加问题的代码段来更新问题。焦点处理程序应该做什么?我打赌有更好的办法。