e838. 使JTabbedPane中的卡片能用按键的方式选取

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);
Related Examples
上一篇:怎样使GridView中满足某个条件的行可编辑,其余行不可编辑?


下一篇:1. 在config.ini文件中加入dm.park.time=1,会使uap中的tomcat启动加快