How To: Make Keyboard Keys To Execute A Method?

Discussion in 'Java' started by clusardi2k@aol.com, Sep 7, 2012.

  1. Guest

    Hello,

    How do I get a sequence of keyboard keys to execute a method.

    For example, if someone types the "control" key, "shift" key, and the "enter" key I want to execute a method called "keyboard_input". Do you also have a working example.

    Thank you,
    , Sep 7, 2012
    #1
    1. Advertising

  2. In article <>,
    wrote:

    > How do I get a sequence of keyboard keys to execute a method.
    >
    > For example, if someone types the "control" key, "shift" key, and the
    > "enter" key I want to execute a method called "keyboard_input". Do
    > you also have a working example.


    See How to Use Key Bindings:

    <http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html>
    <http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html#eg>

    --
    John B. Matthews
    trashgod at gmail dot com
    <http://sites.google.com/site/drjohnbmatthews>
    John B. Matthews, Sep 7, 2012
    #2
    1. Advertising

  3. Guest

  4. In article <>,
    wrote:

    > > How do I get a sequence of keyboard keys to execute a method.
    > >
    > > For example, if someone types the "control" key, "shift" key, and
    > > the "enter" key I want to execute a method called "keyboard_input".
    > > Do you also have a working example.


    To which I replied,

    > See How to Use Key Bindings:
    >
    > <http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html>
    > <http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html#eg>


    To which you replied,

    > <http://docs.oracle.com/javase/tutorial/uiswing/examples/events/KeyEventDemoProject/src/events/KeyEventDemo.java>


    KeyListener is fairly low-level; it might be appropriate for "a
    sequence of keyboard keys." The rest of your question mentions keys
    used as modifiers, for which key bindings are considerably more
    convenient.

    See also, How to Use Actions:

    <http://docs.oracle.com/javase/tutorial/uiswing/misc/action.html>

    --
    John B. Matthews
    trashgod at gmail dot com
    <http://sites.google.com/site/drjohnbmatthews>
    John B. Matthews, Sep 7, 2012
    #4
  5. Roedy Green Guest

    On Fri, 7 Sep 2012 05:10:46 -0700 (PDT), wrote,
    quoted or indirectly quoted someone who said :

    >For example, if someone types the "control" key,

    "shift" key, and the "enter" key I want to execute a method called
    "keyboard_input". Do you also have a working example.

    See http://mindprod.com/jgloss/jmenu.html

    the easiest way is to make the keys accelerator shortcuts for a menu.
    --
    Roedy Green Canadian Mind Products http://mindprod.com
    A new scientific truth does not triumph by convincing its opponents and making them see the light,
    but rather because its opponents eventually die, and a new generation grows up that is familiar with it.
    ~ Max Planck 1858-04-23 1947-10-04
    Roedy Green, Sep 8, 2012
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jordan R.

    Disabling keyboard keys - why?

    Jordan R., Nov 15, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    757
    =?Utf-8?B?U3JlZWppdGggUmFt?=
    Nov 15, 2005
  2. Canonical Latin

    Read keys without keyboard focus

    Canonical Latin, Jun 19, 2005, in forum: Java
    Replies:
    9
    Views:
    1,001
    Canonical Latin
    Jun 26, 2005
  3. wylbur37
    Replies:
    3
    Views:
    514
  4. mhangman

    how can we send keys to keyboard

    mhangman, Oct 7, 2008, in forum: Python
    Replies:
    6
    Views:
    476
    mhangman
    Oct 7, 2008
  5. Savas Ates
    Replies:
    1
    Views:
    270
    Patrice
    Aug 17, 2004
Loading...

Share This Page