本文整理匯總了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();
}
});
}