Java Code Examples for org.openide.awt.Mnemonics#findMnemonicAmpersand()

The following examples show how to use org.openide.awt.Mnemonics#findMnemonicAmpersand() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CodeTemplatesPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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);
        }
    }
}
 
Example 2
Source File: JPDASessionActionsProvider.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private String localize(String s) {
    s = NbBundle.getBundle(JPDASessionActionsProvider.class).getString(s);
    int ampIndex = Mnemonics.findMnemonicAmpersand(s);
    if (ampIndex >= 0) {
        s = s.substring(0, ampIndex) + s.substring(ampIndex+1);
    }
    return s;
}
 
Example 3
Source File: ConnectPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static String getLabel(Argument a) {
    String label = translate (a.name());
    if (label == null) {
        label = a.label();
    } else {
        int amp = Mnemonics.findMnemonicAmpersand(label);
        if (amp >= 0) {
            label = label.substring(0, amp) + label.substring(amp + 1);
        }
    }
    return label;
}
 
Example 4
Source File: Column.java    From netbeans with Apache License 2.0 5 votes vote down vote up
Column (
    ColumnModel columnModel
) {
    super (
        columnModel.getID (),
        columnModel.getType () == null ? 
            String.class : 
            columnModel.getType (),
        Actions.cutAmpersand(columnModel.getDisplayName ()),
        columnModel.getShortDescription ()
    );
    this.columnModel = columnModel;
    setValue (
        "SortableColumn",
        Boolean.valueOf (columnModel.isSortable ())
    );
    if (columnModel.getType () == null)
        // Default column!
        setValue (
            "TreeColumnTTV", 
            Boolean.TRUE
        );
    if (Mnemonics.findMnemonicAmpersand(columnModel.getDisplayName()) >= 0) {
        setValue("ColumnDisplayNameWithMnemonicTTV", columnModel.getDisplayName ()); // NOI18N
    }
    Character mnemonic = columnModel.getDisplayedMnemonic();
    if (mnemonic != null) {
        setValue("ColumnMnemonicCharTTV", mnemonic); // NOI18N
    }
    this.propertyEditor = columnModel.getPropertyEditor ();
}
 
Example 5
Source File: FiltersDescriptor.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Creates a new instance of SortByNameAction */
SortAction (DVFilter item) {
    this.filterItem = item;
    String displayName = item.getDisplayName();
    int i = Mnemonics.findMnemonicAmpersand(displayName);
    if (i >= 0) {
        displayName = displayName.substring(0, i) + displayName.substring(i+1);
    }
    putValue(Action.NAME, displayName);
    putValue(Action.SMALL_ICON, item.getIcon());
}