e838. enabling the selection of a tab in a jtabbedpane container using a keystroke.txt

来自「这里面包含了一百多个JAVA源文件」· 文本 代码 · 共 15 行

TXT
15
字号
Setting a mnemonic on a tab allows the tab to be selected with a keystroke. For example, if the mnemonic for a tab were the key L, then typing ALT-L (on Windows) would select the tab. 
    // Create a tabbed pane
    JTabbedPane pane = new JTabbedPane();
    
    // Add a tab
    pane.addTab("Tab Label", component);
    
    // Get index of the new tab
    int index = pane.getTabCount()-1;
    
    // Set the mnemonic; on some look and feels, the L in the label will be underlined
    int keycode = KeyEvent.VK_L;
    pane.setMnemonicAt(index, keycode);

⌨️ 快捷键说明

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