Short cut for Radio buttons (using Ctrl+ key)

How can I select deselect Radio buttons using Ctrl + keys. I know that setMnemonic can be used to access using Alt + key. But I want to use Ctrl also. Please suggest the solution. How can I select using only single key?

Read the API for a meaning of each of the arguments. Here is a simple example showing how to assign an "Action" to the Ctrl+1 and Ctrl+2 keys:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class KeyboardAction extends JFrame
    public KeyboardAction()
        JPanel panel = new JPanel();
        setContentPane( panel );
        JTextField textField1 = new JTextField("Ctrl+1 or Ctrl+2", 10);
        panel.add( textField1 );
        JTextField textField2 = new JTextField("Ctrl+2", 10);
        panel.add( textField2 );
        //  Change the input map of the text field,
        //  therefore, Ctrl+1 only works for the first text field
        Action action1 = new SimpleAction("1");
        Object key1 = action1.getValue(Action.NAME);
        KeyStroke ks1 = KeyStroke.getKeyStroke(KeyEvent.VK_1, KeyEvent.CTRL_MASK);
        textField1.getInputMap().put(ks1, key1);
        textField1.getActionMap().put(key1, action1);
        //  Change the input map of the panel
        //  therefore, Ctrl+2 works for both text fields added to the panel
        Action action2 = new SimpleAction("2");
        Object key2 = action2.getValue(Action.NAME);
        KeyStroke ks2 = KeyStroke.getKeyStroke(KeyEvent.VK_2, KeyEvent.CTRL_MASK);
        panel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks2, key2);
        panel.getActionMap().put(key2, action2);
    class SimpleAction extends AbstractAction
        public SimpleAction(String name)
            putValue( Action.NAME, "Action " + name );
        public void actionPerformed(ActionEvent e)
            System.out.println( getValue( Action.NAME ) );
    public static void main(String[] args)
        KeyboardAction frame = new KeyboardAction();
        frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
        frame.pack();
        frame.setVisible(true);
}Also, if you search the forum using the keyword "getActionMap", I'm sure you'll find other example.

Similar Messages

  • Hi. After I have loaded a picture into Photoshop some of the menu tools are greyed out and I cannot use the keyboard short cut, for instance I cannot use Ctrl   T to enter free transform mode. Also the toolbar is so small I cannot see the icons without ge

    Hi. After loading a picture into Photoshop some of the menu tools are greyed out and I cannot use the keyboard short cuts, for instance I cannot use Ctrl + T for free transform, how do I resolve this problem. In addition the tool Icons are so small I have to get close to the screen to see them, is there anyway the Icons can be made bigger without reducing the resolution of the screen.
    Thanks
    Derek

    Are you working on a background layer? If so, Ctrl + T will not work. Press Alt and double-click your background layer to convert to a normal layer (or right-click BG layer and select Layer from Background) and try again.
    If you're working in Photoshop CC 2014 you can go to Preferences > Experimental Features and tick "Scale UI 200% for high-density displays" to make your buttons and icons larger.

  • I installed iCloud on to a pc.  The shorts cuts did not include notes.  Is there a way to have a short cut for notes or do I need to logon to icloud every time to use notes on my pc?

    I  installed iCloud on my pc and the short cuts did not include notes.  Is there a way to create a short cut for notes or do I have to logon to iCloud every time I use notes on my pc?

    Open the Mac App Store on your MacBook Pro
    Hold the Option key and click on “Purchases”
    Hold the Option key and click on “OS X Lion” from the purchased app list
    “Installed’ should now say “Install” which allows you to download OS X Lion.
    This assumes you are using the same Apple ID on both computers.
    Lion does not get installed on an iPad. It runs iOS.

  • Keyboard short-cut for Restart and Shutdown?

    Since recent keyboards and Mac OS X doesnt have keyboard short-cuts for Shutdown and Restart, is it possible to create new ones for these functions?
    Also, why doesnt Mac OS X have these anymore (such as when it had the keyboard with that button you hit to bring up dialog box to shutdown, restart, etc).. that's what I'm looking for...
    As for the reason I want this.. sometimes my display goes blank and I can't see anything and hence since you cant see the screen to mouse over to restart, etc... if I could hit a keyboard combo to bring up the restart dialog box and I then hit Enter, it would execute that action...

    The Shutdown and Restart shortcuts are here
    <http://docs.info.apple.com/article.html?artnum=106567>
    Most shortcuts are here
    <http://docs.info.apple.com/article.html?artnum=75459> with more links at the bottom of the page.

  • Short cut command, shift, Z use to launch esko workflow in CS6 illustrator upgraded to CC dent work

    short cut command, shift, Z use to launch esko workflow in CS6 illustrator upgraded to CC dent work

    Then you changed it in CS6. The normal preset usage for that preset is to Redo an Undo.

  • ADF 10.1.3 -  Default value for radio button

    Hi
    How to set the default value for Radio button?
    I have Yes and No fixed values for a radio button, and couldn't find any option to set the default value.
    How can I set Yes as default value?
    Appreciate your help.

    FrameworkSpl,
    What are you using for the model layer? If you are using ADF Business Components, simply set the default value for the attribute upon which you are basing the radio buttons.
    John

  • Is there a keyboard short cut for audio fadeout?

    is there a keyboard short cut for audio fadeout?
    (like ctrl+d for cross dissolve)
    arikw

    If you are at the end of an audio clip and its not butted against another (which it shouldnt be because audio clips should be on separate tks)...
    CTRL-Shift -D    will give you an audio  fade. instead of aan audio cross dissolve.

  • What is the short cut for Square meters in Motion 5?

    What is the short cut for Square meters in Motion 5?

    and in case, you meant a simple m²
    in your System Prefs/Keyboard, check the box 'Overview in Menu'
    you'll then find this icon to click on, opening this
    goto 'Numbers', double click the superscripted ² and it will added wherever your cursor is actually ...
    (very useful to apply arrows ⇐, or symbols ☏ or dingbats pics as ⚽︎ or pointers  ☞ in any app ..)

  • How can I make a 1-Click short cut for a specific tool in Adobe Acrobat 9 Pro?

    How can I make a 1-Click short cut for Adobe Acrobat 9 Pro for the function "Create" > "PDF from Scanner" > "Black & White Document"?

    No, Acrobat can't do that.

  • Make a 1-Click short cut for Adobe Acrobat 9 Pro specific function

    How can I make a 1-Click short cut for Adobe Acrobat 9 Pro for the function "Create" > "PDF from Scanner" > "Black & White Document"?

    How can I make a 1-Click short cut for Adobe Acrobat 9 Pro for the function "Create" > "PDF from Scanner" > "Black & White Document"?

  • Func- Code for Radio-button in Module-pool Prg.

    Hi Friend's.
    I have define 2 Radio button
    on Module-pool screen.
    I am not been able to triger the Radio button in
    Pai .
    How can i assign the function code for
    radio-button in module-pool.
    pls can any one help me

    Hi,
    For radion buttons, what ever the name you will give that name only will hold that value ( Either selected or not ). But this variable should be declared as global variable in main program.
    Still if you want to assign function code, you can assign one like other fields on the screen.

  • Why not autoskip for radio buttons? and the  update_allowed FALSE issue

    I would so dearly love there to be autoskip for radio buttons. (forms 11.1.1.4 jre 6...24) There is no autoskip property for the radio group nor for the individual buttons.
    I don't find an easy way to emulate it either. Or am I missing something?
    Anyone else solve this problem already? When the user selects a radio choice I want the focus to move
    to the next enabled item on the form. You can do this with text items but not with radio groups. (In some cases the radio group has a when-radio-changed trigger
    that enables/disables following items). This would all be a lot easier if radio groups just had autoskip. I wonder why they don't?
    BTW the following has cost me a huge amount of time. In 6i it was the case in my experience that if you
    disabled an item like this:
    PROCEDURE disable_item (myitem in varchar2) IS
    BEGIN
         copy(null,myitem);
            set_item_property(myitem,enabled,property_false);
         set_item_property(myitem,visual_attribute,'DISABLED');
    END;Then that could be reversed as so (the weird thing was you had to set navigable also despite not
    having changed it yourself.
    PROCEDURE enable_item (myitem in varchar2) IS
    BEGIN
      set_item_property(myitem,enabled,property_true);
      set_item_property(myitem,navigable,property_true);
      set_item_property(myitem,visual_attribute,'ENABLED');
    END;But in 11.1.1.4 I had lots of trouble with Lov's not rising after the item had been disabled and then
    re-enabled. No error message. Just didn't do it. Eventually I figured out that what happens is that
    after disabling an item the item as also non-updateable. This was not the case in 6i. So then
    the enable item code has to be something like this: [Note despite that not update_allowed it did not
    automatically grey out the item firefox 3.6.17 and it still has to be done programmatically.]
    PROCEDURE enable_item (myitem in varchar2) IS
    BEGIN
      set_item_property(myitem,enabled,property_true);
      set_item_property(myitem,navigable,property_true);
      set_item_property(myitem,visual_attribute,'ENABLED');
      set_item_property(myitem,update_allowed,property_true);
    END;

    Well right now 11.1.1.4 for autoskip for radio buttons this seems to be working ok. Crossing my fingers!
    a block level when-radio-changed trigger with after scope (where item level when-radio-changed triggers
    have before scope) with a simple next_item in there.
    Where I was having problems before was next_item-ing onto disabled items. There was some kind of issue
    with lov's. I'm having less trouble raising the lov programmatically. but also I had the problem that
    items were getting set non-update_allowed without my realization.
    when new item instance:
    declare
         currfield varchar2(70) := null;
    begin     
         currfield := :system.trigger_field;
    if (get_item_property(currfield,UPDATE_ALLOWED) = 'TRUE')
         and (get_item_property(currfield,UPDATE_PERMISSION) = 'TRUE') then
           list_values;
    else
         mess(currfield || ' UPDATE not allowed');
    end if;
    end;(mess is my program to display alerts.)

  • Want to create F1 Help for radio button in my report

    Hi All,
          I want to create F1 Help for radio button in my report program. Which function module should i call in <b>at selection screen on help-request</b>
          Also do I need to define the texts somewhere or I can pass it directly to the function module.

    Try DYN_FIELD_F1_HELP,
    ~Suresh
    that is only for Dic fields..
    Pl take alook at this<a href="http://help.sap.com/saphelp_erp2005vp/helpdata/en/79/34a243d9b511d1950e0000e8353423/frameset.htm">SAP Help</a>
    ~Suresh
    Message was edited by: Suresh Datti

  • Because you do not leave a short cut for old versions in the sites? Do not understand that the updating can bring us unpleasant surprises and perhaps it be necessary to do a downgrade of version?

    New versions not always work for all. Put in Your sites, '''CLEAR''' and '''of QUITE VISIBLE form''', a '''short cut''' for the '''old versions'''.

    Please be aware that anything except Firefox 10.0 and Firefox 3.6.26 don't have the latest security fixes, and Mozilla really doesn't want any other version to be downloaded. That is why Mozilla doesn't provide links to download any other version.
    You can get Firefox 3.6.26 from here: <br />
    http://www.mozilla.com/en-US/firefox/all-older.html

  • Global binding for radio buttons needs tweaking

    When selecting global binding for a text or numeric field, its corresponding field with the same name also changes to global binding.
    However when doing this for radio button exclusion groups, the other radio button groups don't automatically change to global. You have to do it manually.

    Found the problem in another topic:
    scott sheck - 1:30am Jun 29, 07 PST (#6 of 7)
    A pasted radio button is automatically added to an existing exclusion group if the last added item was a radio button. This is in the help.
    I wish there was a default to turn this off because I don't want to add a temporary item just to get a new exclusion group.

Maybe you are looking for

  • Rule Result not returned back to Workflow container

    Hi , We have a workflow where the approver for a Process is Manager of  any Orgunit . Now the manager is determined using a Rule with Category u201CFunction To be executedu201D . The Business requirement is so that If the immediate manager for any Or

  • Literal string

    Where can I find how to put a literal string into an expression? When I search for TestStand string literal, I find nothing. Thanks.

  • PnP Driver, NVIDIA, for Windows 8

    In need of some serious assistance.  I did a clean install of Windows 8 Professional on an HP Compaq Presario CQ60-215DX.  Everything went smoothly except there was one driver that didn't download with it labeled "Coprocessor".  Despite the driver be

  • Can not see photos

    Hi, I recently installed iLife 11 and when I opened iMovie and clicked on photos, a message came up saying I needed to have iPhoto 5 to be able to view the photos in my photo library. Any idea what I need to do?

  • Glossy vs Hi-Res Glossy vs Hi-Res Antiglare vs Retina Display

    Which one of these display screens is better for a designer who needs to use the MBP for long periods of time, creating presentations on Photoshop and Microsoft Office PowerPoint?  Which one is kinder to the eyes? Glossy Widescreen Display Hi-Res Glo