JPopupMenu in table cell editor会出现table失去焦点,触发stop cell editing,removeEditor

JPopupMenu in table cell editor

参考:http://www.jroller.com/santhosh/entry/multiline_in_table_cell_editing1

TextArea获得焦点时,table失去焦点,会触发stop cell editing,removeEditor…界面变成

通过重写JTable的public void removeEditor()方法可以避免
//TPropertySheet instanceof JTable
        TPropertySheet sheet = new TPropertySheet(box) {
            public void removeEditor() {
                TableCellEditor editor = getCellEditor();


                if (editor != null && editor instanceof
PopupMenuEditor) {


                    PopupMenuEditor popupMenuEditor =
((PopupMenuEditor) editor);


                    if (popupMenuEditor.isBodyVisible()) {


                        return;


                    }


                }


                super.removeEditor();


            }


        };



http://cid-24183f266c78caa8.skydrive.live.com/embedrowdetail.aspx/Code/PopupMenuEditor.zip


四 × = 12