本文整理汇总了Java中javax.swing.JTabbedPane.setMnemonicAt方法的典型用法代码示例。如果您正苦于以下问题:Java JTabbedPane.setMnemonicAt方法的具体用法?Java JTabbedPane.setMnemonicAt怎么用?Java JTabbedPane.setMnemonicAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTabbedPane
的用法示例。
在下文中一共展示了JTabbedPane.setMnemonicAt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loc
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private static void loc(JTabbedPane p, int tabIdx, String key, JEditorPane ep) {
JLabel label = new JLabel(); // Only for setting tab names
String tabName = loc("CTL_" + key); //NOI18N
Mnemonics.setLocalizedText(label, tabName);
p.setTitleAt(tabIdx, label.getText());
int idx = Mnemonics.findMnemonicAmpersand(tabName);
if (idx != -1 && idx + 1 < tabName.length()) {
char ch = Character.toUpperCase(tabName.charAt(idx + 1));
p.setMnemonicAt(tabIdx, ch);
if (ep != null) {
ep.setFocusAccelerator(ch);
}
}
}
示例2: TabbedPaneDemo
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
public TabbedPaneDemo() {
super(new GridLayout(1, 1));
JTabbedPane tabbedPane = new JTabbedPane();
ImageIcon icon = createImageIcon("images/middle.gif");
JComponent panel1 = makeTextPanel("Panel #1");
tabbedPane.addTab("Tab 1", icon, panel1, "Does nothing");
tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);
JComponent panel2 = makeTextPanel("Panel #2");
tabbedPane.addTab("Tab 2", icon, panel2, "Does twice as much nothing");
tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);
JComponent panel3 = makeTextPanel("Panel #2");
tabbedPane.addTab("Tab 3", icon, panel3, "Still does nothing");
tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);
JComponent panel4 = makeTextPanel("Panel #4 (has a preferred size of 410 x 50).");
panel4.setPreferredSize(new Dimension(410, 50));
tabbedPane.addTab("Tab 4", icon, panel4, "Does nothing at all");
tabbedPane.setMnemonicAt(3, KeyEvent.VK_4);
// Add the tabbed pane to this panel.
add(tabbedPane);
// The following line enables to use scrolling tabs.
tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
}
示例3: SyncSinkFrame
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
public SyncSinkFrame(){
super("SyncSink");
logTextField = new JTextArea();
logTextField.setEditable(false);
DefaultCaret caret = (DefaultCaret)logTextField.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
StringBuilder sb = new StringBuilder();
sb.append("----------------------------------------\n");
sb.append("Configuration currently in use: \n");
for(Key key : Key.values()){
sb.append("\t");
sb.append(key.name());
sb.append("=");
sb.append(Config.get(key));
sb.append("\n");
}
sb.append("----------------------------------------\n");
logTextField.setText(sb.toString());
this.setLayout(new BorderLayout());
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
cs = new CoordinateSystem(AxisUnit.OCCURENCES, 0, 1000);
linkedPanel = new LinkedPanel(cs);
linkedPanel.addLayer(new BackgroundLayer(cs));
linkedPanel.addLayer(new ZoomMouseListenerLayer());
linkedPanel.addLayer(new DragMouseListenerLayer(cs));
linkedPanel.addLayer(new BackgroundLayer(cs));
linkedPanel.addLayer(new TimeAxisLayer(cs));
linkedPanel.addLayer(new SelectionLayer(cs));
linkedPanel.getViewPort().addViewPortChangedListener(this);
matches = new ArrayList<NFFTSyncMatch>();
this.streamLayers = new ArrayList<StreamLayer>();
this.streamFiles = new ArrayList<File>();
JTabbedPane tabbedPane = new JTabbedPane();
tabbedPane.addTab("Timebox plot", null, linkedPanel,"Timebox plots");
tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);
tabbedPane.addTab("Messages", null, new JScrollPane(logTextField),"Logs messages");
tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);
tabbedPane.setTabPlacement(JTabbedPane.BOTTOM);
tabbedPane.setBorder(new EmptyBorder(0,0,0,0));
this.add(tabbedPane,BorderLayout.CENTER);
this.add(createStatusBarPanel(),BorderLayout.SOUTH);
new FileDrop(null, tabbedPane, /*dragBorder,*/ new FileDrop.Listener(){
public void filesDropped( final File[] files ){
new Thread(new Runnable(){
@Override
public void run() {
for( int i = 0; i < files.length; i++) {
final File fileToAdd = files[i];
logMessage("Adding " + fileToAdd.getPath() + "...");
openFile(fileToAdd,streamFiles.size());
logMessage("Added " + fileToAdd.getPath() + ".");
}
}},"File adding thread").start();
}
});
}