Combining JXTable with RXTable

限于喜欢 提交于 2019-12-01 11:47:28
kleopatra

a quick hack working for two of the three selection types

       // in selectAll(EventObject) special case the formatted early
       if (editor instanceof JFormattedTextField) {
           invokeSelectAll(editor);
           return;
       }


        private void invokeSelectAll(final JFormattedTextField editor) {
            // old trick: force to commit, and invoke selectall
            editor.setText(editor.getText());
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    editor.selectAll();
                }
            });
        }

was remembered of the trick by How to select all text in a JFormattedTextField when it gets focus? - doesn't handle the case when starting edit by typing, in this case the content is not deleted (as for a normal textfield) but the new key is added.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!