javax.swing.JLabel.setDisplayedMnemonic()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(180)

本文整理了Java中javax.swing.JLabel.setDisplayedMnemonic()方法的一些代码示例,展示了JLabel.setDisplayedMnemonic()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JLabel.setDisplayedMnemonic()方法的具体详情如下:
包路径:javax.swing.JLabel
类名称:JLabel
方法名:setDisplayedMnemonic

JLabel.setDisplayedMnemonic介绍

暂无

代码示例

代码示例来源:origin: deathmarine/Luyten

protected JPanel getFontFamilyPanel() {
  if (fontNamePanel == null) {
    fontNamePanel = new JPanel();
    fontNamePanel.setLayout(new BorderLayout());
    fontNamePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    fontNamePanel.setPreferredSize(new Dimension(180, 130));
    JScrollPane scrollPane = new JScrollPane(getFontFamilyList());
    scrollPane.getVerticalScrollBar().setFocusable(false);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());
    p.add(getFontFamilyTextField(), BorderLayout.NORTH);
    p.add(scrollPane, BorderLayout.CENTER);
    JLabel label = new JLabel(("Font Name"));
    label.setHorizontalAlignment(JLabel.LEFT);
    label.setHorizontalTextPosition(JLabel.LEFT);
    label.setLabelFor(getFontFamilyTextField());
    label.setDisplayedMnemonic('F');
    fontNamePanel.add(label, BorderLayout.NORTH);
    fontNamePanel.add(p, BorderLayout.CENTER);
  }
  return fontNamePanel;
}

代码示例来源:origin: com.jgoodies/jgoodies-common

private static void configure0(JLabel label, MnemonicText mnemonicText) {
  label.setText(mnemonicText.text);
  label.setDisplayedMnemonic(mnemonicText.key);
  label.setDisplayedMnemonicIndex(mnemonicText.index);
}

代码示例来源:origin: deathmarine/Luyten

protected JPanel getFontStylePanel() {
  if (fontStylePanel == null) {
    fontStylePanel = new JPanel();
    fontStylePanel.setLayout(new BorderLayout());
    fontStylePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    fontStylePanel.setPreferredSize(new Dimension(140, 130));
    JScrollPane scrollPane = new JScrollPane(getFontStyleList());
    scrollPane.getVerticalScrollBar().setFocusable(false);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());
    p.add(getFontStyleTextField(), BorderLayout.NORTH);
    p.add(scrollPane, BorderLayout.CENTER);
    JLabel label = new JLabel(("Font Style"));
    label.setHorizontalAlignment(JLabel.LEFT);
    label.setHorizontalTextPosition(JLabel.LEFT);
    label.setLabelFor(getFontStyleTextField());
    label.setDisplayedMnemonic('Y');
    fontStylePanel.add(label, BorderLayout.NORTH);
    fontStylePanel.add(p, BorderLayout.CENTER);
  }
  return fontStylePanel;
}

代码示例来源:origin: org.jdesktop.bsaf/bsaf

private static void configureLabel(JLabel target, String text, int key, int index) {
    target.setText(text);
    if (key != KeyEvent.VK_UNDEFINED) {
      target.setDisplayedMnemonic(key);
    }
    if (index != -1) {
      target.setDisplayedMnemonicIndex(index);
    }
  }
}

代码示例来源:origin: deathmarine/Luyten

protected JPanel getFontSizePanel() {
  if (fontSizePanel == null) {
    fontSizePanel = new JPanel();
    fontSizePanel.setLayout(new BorderLayout());
    fontSizePanel.setPreferredSize(new Dimension(70, 130));
    fontSizePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    JScrollPane scrollPane = new JScrollPane(getFontSizeList());
    scrollPane.getVerticalScrollBar().setFocusable(false);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());
    p.add(getFontSizeTextField(), BorderLayout.NORTH);
    p.add(scrollPane, BorderLayout.CENTER);
    JLabel label = new JLabel(("Font Size"));
    label.setHorizontalAlignment(JLabel.LEFT);
    label.setHorizontalTextPosition(JLabel.LEFT);
    label.setLabelFor(getFontSizeTextField());
    label.setDisplayedMnemonic('S');
    fontSizePanel.add(label, BorderLayout.NORTH);
    fontSizePanel.add(p, BorderLayout.CENTER);
  }
  return fontSizePanel;
}

代码示例来源:origin: com.anrisoftware.prefdialog/prefdialog-core

private void updateMnemonic() {
  Integer mnemonic = getMnemonic();
  if (mnemonic != null) {
    titleLabel.setDisplayedMnemonic(mnemonic);
  }
  int index = getMnemonicIndex();
  if (index != -1) {
    titleLabel.setDisplayedMnemonicIndex(index);
  }
}

代码示例来源:origin: wiztools/rest-client

jp_center_west.setLayout(new GridLayout(2, 1, RESTViewImpl.BORDER_WIDTH, RESTViewImpl.BORDER_WIDTH));
JLabel jl_in = new JLabel("Input: ");
jl_in.setDisplayedMnemonic('i');
jl_in.setLabelFor(jtf_in);
JLabel jl_out = new JLabel("Output: ");

代码示例来源:origin: wiztools/rest-client

if(!keys.isEmpty()) {AutoCompleteDecorator.decorate(jtf_key, keys, false);}
final JTextField jtf_value = new JTextField(TEXT_FIELD_SIZE);
jl_key.setDisplayedMnemonic('k');
jl_key.setLabelFor(jtf_key);
JButton jb_add = new JButton(UIUtil.getIconFromClasspath(RCFileView.iconBasePath + "add.png"));

代码示例来源:origin: wiztools/rest-client

jl_url.setDisplayedMnemonic('u');
rest_ui.getFrame().getRootPane().setDefaultButton(jb_request);

代码示例来源:origin: org.netbeans.api/org-openide-awt

/**
 * Wrapper for AbstractButton.setMnemonic and JLabel.setDisplayedMnemonic
 * @param item AbstractButton/JLabel
 * @param mnem Mnemonic char to set, latin [a-z,A-Z], digit [0-9], or any VK_ code
 */
private static void setMnemonic(Object item, int mnem) {
  if (isAquaLF()) {
    // there shall be no mnemonics on macosx.
    //#55864
    return;
  }
  if ((mnem >= 'a') && (mnem <= 'z')) {
    mnem = mnem + ('A' - 'a');
  }
  if (item instanceof AbstractButton) {
    AbstractButton b = (AbstractButton) item;
    b.putClientProperty(PROP_MNEMONIC, mnem);
    b.setMnemonic(mnem);
  } else {
    ((JLabel) item).setDisplayedMnemonic(mnem);
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-nodes

l.setDisplayedMnemonic(Node.getString("LAB_listOrder_Mnemonic").charAt(0));
constraints = new GridBagConstraints();
constraints.gridx = 0;

代码示例来源:origin: com.google.code.validationframework/validationframework-swing

/**
   * @see AbstractComponentProperty#setPropertyValueToComponent(Object)
   */
  @Override
  protected void setPropertyValueToComponent(Integer value) {
    Integer effectiveValue = value;
    if (effectiveValue == null) {
      effectiveValue = KeyEvent.VK_UNDEFINED;
    }
    component.setDisplayedMnemonic(effectiveValue);
  }
}

代码示例来源:origin: otros-systems/otroslogviewer

private void addLabel(String string, char c, JComponent jComponent) {
 JLabel label = new JLabel(string);
 p.add(label);
 label.setDisplayedMnemonic(c);
 label.setLabelFor(jComponent);
 p.add(jComponent, "growx, wrap");
}

代码示例来源:origin: otros-systems/otroslogviewer

protected void addLabel(String string, char c, JComponent labelFor, JComponent jComponent, JPanel panelToAdd) {
 JLabel label = new JLabel(string);
 panelToAdd.add(label);
 label.setDisplayedMnemonic(c);
 label.setLabelFor(labelFor);
 panelToAdd.add(jComponent, "wrap");
}

代码示例来源:origin: io.github.dheid/fontchooser

private void addSizeLabel() {
  sizeLabel.setLabelFor(sizePane);
  sizeLabel.setDisplayedMnemonic(ResourceBundleUtil.getFirstChar(resourceBundle, "font.size.mnemonic"));
  sizeLabel.setText(resourceBundle.getString("font.size"));
  GridBagConstraints gridBagConstraints = new GridBagConstraints();
  gridBagConstraints.anchor = GridBagConstraints.LINE_START;
  gridBagConstraints.insets = new Insets(0, 0, 5, 0);
  fontPanel.add(sizeLabel, gridBagConstraints);
}

代码示例来源:origin: otros-systems/otroslogviewer

public ValidationView() {
 super("validView", "Validation view", "View with validation,");
 jPanel = new JPanel(new MigLayout());
 tf = new JTextField(20);
 PromptSupport.setPrompt("Enter name with uppercase", tf);
 JLabel jLabel = new JLabel("Name: ");
 jLabel.setDisplayedMnemonic('m');
 jLabel.setLabelFor(tf);
 jPanel.add(jLabel);
 jPanel.add(tf);
}

代码示例来源:origin: org.fudaa.framework.ebli/ebli-common

public EbliFindComponentDefault(final String _lb) {
 txtFind_ = new BuTextField(10);
 txtFind_.setToolTipText(getIndiceHelpComplete());
 setLayout(new BuGridLayout(2, 5, 5));
 final JLabel lb = new JLabel(_lb);
 lb.setLabelFor(txtFind_);
 lb.setDisplayedMnemonic(_lb.charAt(0));
 add(lb);
 add(txtFind_);
}

代码示例来源:origin: net.java.abeille/abeille

/** Creates new form SaveMacroPanel */
public JavaFastImportPanel(JavaFastImport jfi) {
  this.jfi = jfi;
  initComponents();
  getAccessibleContext().setAccessibleDescription(LocaleSupport.getString("ACSD_JFI")); // NOI18N
  listLabel.setDisplayedMnemonic(LocaleSupport.getString("JFI_listLabelMnemonic", "M").charAt(0)); // NOI18N
  javax.swing.JList jl = jfi.getResultList();
  listScrollPane.setViewportView(jl);
  listLabel.setLabelFor(jl);
  jl.getAccessibleContext().setAccessibleDescription(LocaleSupport.getString("ACSD_JFI_listLabel")); // NOI18N
  setMaximumSize(new Dimension(400, 200));
}

代码示例来源:origin: net.java.abeille/abeille

/** Creates new form KeySequenceInputPanel with empty sequence */
public KeySequenceInputPanel() {
  initComponents();
  keySequenceLabel.setDisplayedMnemonic(LocaleSupport.getString("LBL_KSIP_Sequence_Mnemonic").charAt(0)); // NOI18N
  keySequenceInputField.getAccessibleContext().setAccessibleDescription(LocaleSupport.getString("ACSD_LBL_KSIP_Sequence")); // NOI18N
  getAccessibleContext().setAccessibleName(LocaleSupport.getString("MSP_AddTitle")); // NOI18N
  getAccessibleContext().setAccessibleDescription(LocaleSupport.getString("ACSD_KSIP")); // NOI18N
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

/** Creates new form KeySequenceInputPanel with empty sequence*/
public KeySequenceInputPanel() {
  initComponents ();
  
  keySequenceLabel.setDisplayedMnemonic(LocaleSupport.getString("LBL_KSIP_Sequence_Mnemonic").charAt(0)); // NOI18N
  keySequenceInputField.getAccessibleContext().setAccessibleDescription(LocaleSupport.getString("ACSD_LBL_KSIP_Sequence")); // NOI18N
  getAccessibleContext().setAccessibleName(LocaleSupport.getString("MSP_AddTitle")); // NOI18N
  getAccessibleContext().setAccessibleDescription(LocaleSupport.getString("ACSD_KSIP")); // NOI18N
}

相关文章

微信公众号

最新文章

更多

JLabel类方法