Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #18579 > unrolled thread

How To: Make Keyboard Keys To Execute A Method?

Started byclusardi2k@aol.com
First post2012-09-07 05:10 -0700
Last post2012-09-07 22:28 -0700
Articles 5 — 3 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  How To: Make Keyboard Keys To Execute A Method? clusardi2k@aol.com - 2012-09-07 05:10 -0700
    Re: How To: Make Keyboard Keys To Execute A Method? "John B. Matthews" <nospam@nospam.invalid> - 2012-09-07 09:47 -0400
      Re: How To: Make Keyboard Keys To Execute A Method? clusardi2k@aol.com - 2012-09-07 09:10 -0700
        Re: How To: Make Keyboard Keys To Execute A Method? "John B. Matthews" <nospam@nospam.invalid> - 2012-09-07 13:15 -0400
    Re: How To: Make Keyboard Keys To Execute A Method? Roedy Green <see_website@mindprod.com.invalid> - 2012-09-07 22:28 -0700

#18579 — How To: Make Keyboard Keys To Execute A Method?

Fromclusardi2k@aol.com
Date2012-09-07 05:10 -0700
SubjectHow To: Make Keyboard Keys To Execute A Method?
Message-ID<860b8b1f-3b08-4cde-8473-16cd910a54af@googlegroups.com>
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,

[toc] | [next] | [standalone]


#18582

From"John B. Matthews" <nospam@nospam.invalid>
Date2012-09-07 09:47 -0400
Message-ID<nospam-F990C0.09475507092012@news.aioe.org>
In reply to#18579
In article <860b8b1f-3b08-4cde-8473-16cd910a54af@googlegroups.com>,
 clusardi2k@aol.com 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>

[toc] | [prev] | [next] | [standalone]


#18588

Fromclusardi2k@aol.com
Date2012-09-07 09:10 -0700
Message-ID<9396fa63-f5c0-4f1b-a761-e6494971cafd@googlegroups.com>
In reply to#18582

http://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/uiswing/examples/events/KeyEventDemoProject/src/events/KeyEventDemo.java

[toc] | [prev] | [next] | [standalone]


#18592

From"John B. Matthews" <nospam@nospam.invalid>
Date2012-09-07 13:15 -0400
Message-ID<nospam-C4970F.13154207092012@news.aioe.org>
In reply to#18588
In article <9396fa63-f5c0-4f1b-a761-e6494971cafd@googlegroups.com>,
 clusardi2k@aol.com 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>

[toc] | [prev] | [next] | [standalone]


#18603

FromRoedy Green <see_website@mindprod.com.invalid>
Date2012-09-07 22:28 -0700
Message-ID<nrll48t64iak3tk0hbgmqamfb6k9nbaa1a@4ax.com>
In reply to#18579
On Fri, 7 Sep 2012 05:10:46 -0700 (PDT), clusardi2k@aol.com 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 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web