⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e955. setting the activation click count for a table cell editor in a jtable component.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
By default, a table cell editor is activated with a double-click. The activation behavior is controlled by the renderer, not by a table property. To change this, override the isCellEditable() method of the editor. See e953 Creating a Custom Table Cell Editor in a JTable Component for more information about table cell editors. 
    
    public class MyTableCellEditor extends AbstractCellEditor implements TableCellEditor {
        // See e953 Creating a Custom Table Cell Editor in a JTable Component
        // for other methods that need to be implemented.
    
        public boolean isCellEditable(EventObject evt) {
            if (evt instanceof MouseEvent) {
                int clickCount;
    
                // For single-click activation
                clickCount = 1;
    
                // For double-click activation
                clickCount = 2;
    
                // For triple-click activation
                clickCount = 3;
    
                return ((MouseEvent)evt).getClickCount() >= clickCount;
            }
            return true;
        }
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -