Results 1 to 4 of 4

Thread: JButton action

  1. #1
    jperson is offline Member
    Join Date
    Jan 2010
    Posts
    61
    Rep Power
    0

    Default JButton action

    i make an app with two JButton (ok,cancel)

    i want to excute action of ok Button when pressing ENTER_KEY and excute action of cancel when pressing SPACE_KEY

    how can i do this in java ?

    i want an example please ...:confused::confused:

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default

    Look at the Examples in Sun's keyBinding tutorial.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    5

    Default KeyListener


  4. #4
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default

    Huh?! Then the buttons will only work when having the focus. That won't help much
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

Similar Threads

  1. Call action of JButton from another class
    By geckolux in forum AWT / Swing
    Replies: 4
    Last Post: 01-06-2014, 11:24 AM
  2. Jsp to Action class
    By Sujatha.G in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 01-05-2010, 10:59 AM
  3. Please help on Button action
    By michaelxiao in forum New To Java
    Replies: 4
    Last Post: 04-24-2009, 10:55 PM
  4. JButton Action Listner
    By 2o2 in forum AWT / Swing
    Replies: 19
    Last Post: 10-11-2008, 01:07 AM
  5. Few action in one Jbutton
    By kubiasty in forum New To Java
    Replies: 0
    Last Post: 07-25-2007, 10:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •