Results 1 to 8 of 8
  1. #1
    Coold0wn is offline Member
    Join Date
    Aug 2011
    Posts
    71
    Rep Power
    0

    Default Jbutton blocks Keylistener

    hi guys,
    my Jbutton blocks the key listening.
    it just wont work anymore if i add the Jbutton to the Frame.getContentPane().
    (wont work when i remove it again neither.)

    i hope you know sth that stops this... :D
    thanks already..

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Jbutton blocks Keylistener

    Your problem is one of focus since key listeners only work if the component listened to has the focus. This is another good reason not to use a key listener but rather key binding.

  3. #3
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,798
    Rep Power
    7

    Default Re: Jbutton blocks Keylistener

    Quote Originally Posted by Coold0wn View Post
    i hope you know sth that stops this.
    Since sth is not a real word how can anyone know it?

  4. #4
    Coold0wn is offline Member
    Join Date
    Aug 2011
    Posts
    71
    Rep Power
    0

    Default Re: Jbutton blocks Keylistener

    ah thx fubarable.. ive heard of this key bidning stuff... :D
    but dont know how it works.
    isnt there anything i can do?

    btw: sth = something... normal internet language

  5. #5
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,798
    Rep Power
    7

    Default Re: Jbutton blocks Keylistener

    There is nothing normal about it. I speak English not juvenile txtspeak. It costs you nothing to type words out in full. It also has the added bonus that it is not open to interpretation if you do not know what the heck the author is talking about.

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Jbutton blocks Keylistener

    Quote Originally Posted by Coold0wn View Post
    ah thx fubarable.. ive heard of this key bidning stuff... :D
    but dont know how it works.
    isnt there anything i can do?
    Surely there is something you can do: Google for the key bindings tutorials and give them a read.

    btw: sth = something... normal internet language
    I agree with Junky: when you're asking and answering technical questions on a technical forum, clarity of communication is everything. Please take the trouble to avoid unnecessary abbreviations in this forum.

  7. #7
    Coold0wn is offline Member
    Join Date
    Aug 2011
    Posts
    71
    Rep Power
    0

    Default Re: Jbutton blocks Keylistener

    na.. i learned to much of java in the last view weeks ... i dont want to get myself into sth new now.....^^
    my solution now:
    MainFrame.setVisible(false);
    MainFrame.setVisible(true);

    it works cause i dont need button and keylistener at the smae time. so i just do this when the button is removed..
    thanks anyway guys, ill get to the key bindings later maybe :)

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: Jbutton blocks Keylistener

    Quote Originally Posted by Coold0wn View Post
    na.. i learned to much of java in the last view weeks ... i dont want to get myself into sth new now.....^^
    my solution now:
    MainFrame.setVisible(false);
    MainFrame.setVisible(true);

    it works cause i dont need button and keylistener at the smae time. so i just do this when the button is removed..
    thanks anyway guys, ill get to the key bindings later maybe :)
    You've already been asked to spell words in full. Note that the people most capable of helping you here are the same people who are annoyed by the laziness evident in shortening words almost beyond recognition. You have nothing to gain by being stubborn/lazy except an inflated ego. It's your call.

    db

Similar Threads

  1. App that blocks selected web pages.
    By lolaika in forum Advanced Java
    Replies: 3
    Last Post: 06-11-2010, 04:43 PM
  2. Java Blocks??
    By abimaran in forum New To Java
    Replies: 24
    Last Post: 11-07-2009, 03:22 PM
  3. alternative to static initialization blocks
    By paola in forum New To Java
    Replies: 1
    Last Post: 12-06-2008, 05:51 PM
  4. Blocks Language 0.1
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 09-22-2007, 11:21 PM
  5. Task Blocks 0.5
    By johnt in forum Java Software
    Replies: 0
    Last Post: 08-08-2007, 08:43 PM

Posting Permissions

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