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


Groups > comp.lang.java.programmer > #18592

Re: How To: Make Keyboard Keys To Execute A Method?

From "John B. Matthews" <nospam@nospam.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: How To: Make Keyboard Keys To Execute A Method?
Date 2012-09-07 13:15 -0400
Organization The Wasteland
Message-ID <nospam-C4970F.13154207092012@news.aioe.org> (permalink)
References <860b8b1f-3b08-4cde-8473-16cd910a54af@googlegroups.com> <nospam-F990C0.09475507092012@news.aioe.org> <9396fa63-f5c0-4f1b-a761-e6494971cafd@googlegroups.com>

Show all headers | View raw


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>

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web