Keyboard problems with joptionpane.ShowConfirm

hello,
I am using show confirm dialog and there is a yes and no button with it.
I want the software to exit when the user clicks yes button.
the code works fine when the user uses mouse. but when I use the enter key on yes or no button, the application exits in both the cases.
further more if I perform the same action with the space bar on the keyboard it still works fine and when I hit space bar on the no button the application stays. but with enter key the application doesn't seam to take the right yes/ no value in the integer.
what's the problem
and how do I correct it.
thanks
Krishnakant.

import javax.swing.*;
class Testing
   public Testing()
      try{UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");}
      catch(Exception e){e.printStackTrace();}
      int btn = JOptionPane.showConfirmDialog(null,"tab to a button, then press [ENTER]",
                                                         "",JOptionPane.YES_NO_OPTION,-1);
      String selection = "Escape (or 'x') selected";
      if(btn == 0) selection = "Selection = 'Yes'";
      else if(btn == 1)  selection = "Selection = 'No'";
      JOptionPane.showMessageDialog(null,selection);
      System.exit(0);
  public static void main(String[] args){new Testing();}
}

Similar Messages

  • Keyboard problems with Enter, delete, backspace, and right/left arrows

    In some applications, such as Yahoo and this message block right now !!, when composing a message, the arrow keys and delete, backspace keys become non responsive. Various ones will work on a random basis.
    I am getting double "carriage returns" also. Maybe this is why in Omegle when I press ENTER, it will not post a chat message; it will bring up a scroll box and for me to post the comment, I have to use the mouse to click ENTER.
    I have changed batteries in my keyboard, uninstalled /reinstalled Firefox. I have checked the above websites in Chrome and other browsers, and there are no problems.
    This has happened before, I don't recall what the solution was or if it just went away.'''
    Affected sites -- at least these
    http://us.mg6.mail.yahoo.com/neo/launch?ncrumb=Fx5R4O7ccqb&.rand=1041364415&nmig=yes#
    http://omegle.com/
    https://support.mozilla.com/en-US/questions/new?product=beta&category=b2&search=Keyboard+problems+with+Enter%2C+delete%2C+backspace%2C+and+right%2Fleft+arrows&showform=1

    PROBLEM SOLVED: http://forum.archlinux-br.org/viewtopic.php?id=1257
    Solution posted on Brazilian Archlinux forum. Credits to user "920608".
    [cache]
    /etc/xorg.conf
    Section "Files"
             #RgbPath "/usr/X11R6/lib/X11/rgb"
    EndSection
    Section "ServerFlags"
               Option "AutoAddDevices" "False"
    EndSection
    C'ya

  • Strange problem with JOptionPane.showInputDialog

    I have a strange problem with JOptionPane.showInputDialog in that when I run a program anything that is typed in is displayed backwards, for example: I type this character > and this < is what is displayed.
    I've uninstalled the sdk and reinstalled it twice but that hasn't solved my problem and the java plug-in in the control panel is displaying the same symptoms.
    I did a search before posting this but all I got really was posts from people who wanted to reverse their text.
    Thanks for your help on this.

    Is it just the < and > characters?

  • Customized KeyboardFocusManager problems with JOptionPane-Dialogs

    Hi,
    I have a problem I'm not able to solve: With Java 1.4.2 unter Linux, as well as all newer Java Versions (1.4, 1.5, 1.6) under Windows, dialogs created by JOptionPane.showXXXDialog do not react to keyboard events like <Tab> any more when using a customized KeyboardFocusManager. Java 1.5 and 1.6 under Linux work fine.
    Here is what I did:
    I have a JFrame and want some customized focus control when navigating through the Frame with <Tab>. Therefore I've implemented a class
    public class EfaFrameFocusManager extends DefaultKeyboardFocusManagereand said in the main JFrame:
    EfaFrameFocusManager myFocusManager = new EfaFrameFocusManager(this,FocusManager.getCurrentKeyboardFocusManager());
    FocusManager.setCurrentKeyboardFocusManager(myFocusManager);The constructor of my EfaFrameFocusManager stores the JFrame (this) and the original KeyboardFocusManager (2nd arg) for later use. Within my own FocusManager, I've implemented the method
    public void processKeyEvent(Component cur, KeyEvent e)which is checking whether the desired Frame (efaFrame) is currently active or not. If it is active, it's performing my customized operations which is working well. If it is not active (e.g. because a dialog created with JOptionPane.showConfirmDialog() is open), it should perform default actions. So I said within processKeyEvent:
    if (!efaFrame.isActive()) { // efaFrame is the previous "this" arg
      fm.processKeyEvent(cur,e); // fm is the previously stored CurrentKeyboardFocusManager
      return;
    }Instead of invoking processKeyEvent on the original KeyboardFocusManager fm, I also tried super.processKeyEvent(cur,e);, but without any change in behavior.
    As I said before, this is working well under Java 1.5 and 1.6 with Linux.
    However, it is not working unter Windows (any Java version I tried, including 1.4, 1.5 and 1.6) and also not unter Linux with Java 1.4. With these combinations, dialogs created by JOptionPane.showXXXDialog(...) do not respond to the <Tab> key. I do see that my own FocusManagers processKeyEvent method is invoked, and I also see that it invokes the one of the original FocusManager, but the Dialog doesn't react.
    What am I doing wrong?
    Nick.

    I have a JFrame and want some customized focus control when navigating
    through the Frame with <Tab>. sounds like you should be doing this via a FocusTraversalPolicy
    http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html#customFocusTraversal

  • Keyboard Problem with C button on my Satellite L40

    (Sorry for mistakes)
    Hello
    I had a problem with my keyboard and the FN function:
    I installed windows XP on my L40. I have also installed all drivers from the download page. All drivers work well, also the hotkey driver.
    My problem:
    If I want to write normal with it the "c" button doesn't work, I must press FN to make a "c".
    Can anyone help me? It can not be normal.
    Thanks

    Hi again,
    I updated the Bios for XP.
    After That the Problem with the keyboard and the c button is gone.
    All works fine. Thanks.
    For all have Problem with keyboard.
    1. Bios check ( the one for xp or vista)
    2. ckeck if num(numlock) is activate ( if num(can be deaktivate with FN + F11) is on you can get problems with installing the Fn hot key utilitie and driver)
    3. reinstall the hot key driver and utilitie.
    sorry for misstakes in the language!!

  • Keyboard problem with Mac os 10.7 + FileVault to + login screen

    I have a problem with the login screen, the keyboard is recognized as a English keyboard but I have a french keyboard. The menu to change keyboard language is not displayed on login screen since 10.7.2.
    During the session the keyboard is French, it's only for the login screen.
    How can I fix this and switch my keyboard layout to French in login screen ?
    Thank you.

    How did you find out the keyboard layout changed to English? I had a similar problem with my first login after enabling FileVault, and now I think this might be a cause? I have a Spanish keyboard.
    See this thread also:
    https://discussions.apple.com/message/16293028#16293028
    Rolando

  • Keyboard problems with insert button

    Hi, I'm having problems wih the insert button. It doesnt work when i press to activate it. However, this button is also used with the function key to toggle scroll lock which works. What is the problem? Is my labtop defective? I also have this problem with my desktop keyboard. Is it some kinda setting that I disabled because it worked on my desktop keyboard a few days ago and I don't remember setting any different preferences.
    My labtop is the the U550. It is 2 days old.

    Quote from: mild0d on 21-July-12, 03:01:44
    Has anyone had any problems with their keyboard? I bought a gt60 back in april. Everthing with the laptop has been great except for the "W" key. It works fine typeing but in a game and trying to go forward it will stop working and I will have to repress. I also noticed that if I have just used the keyboard and stop using it for a minute it will make this crackling sound. It has freaked me out a couple times.
    Regardless, if it was any other key I would have had no problem but it is pretty much my main gaming key. I RMA'ed through msi and sent it off tuesday. Had anyone had any experience with MSI laptop rma service?   I am just wanting to know what type of turn around time i will have?
    Having the exact same issue with my GT60  :-(

  • IOS 7, iPad 4: keyboard problems with Shift key

    Since I have upgraded my iPad 4 to iOS 7 a few days ago the keyboard drives me mad: I did not experience the overall slowness of the keyboard as reported by so many others. Anyway, I reset my settings just to be safe. But the reset had absolutely no influence on my real problem which is as follows:
    Whenever and wherever (each app) I type, it is just a matter of luck whether or not the keyboard will recognise me typing the Shift key in order to get capital letters - and there are many caps in German words because each noun must be in caps! In 70% of all cases iOS will just write my capital letters as lower-case ones because it just does not recognise me hitting the Shift key, especially when typing quickly. Under iOS 6 this problem did not exist. I am losing so much time fixing missing capitalisation in all my texts (I use iPad for business) and/or typing extra slow and hitting the virtual Shift key on the screen extra hard that there is absolutely no flow in typing. Everything is just slow, whacky and it drives me nuts! How can it be that the latest iPad 4 with so much CPU power cannot handle a simple thing as typing caps? I am also experiencing problem when using the wipe-up gesture to get umlauts on vowels. It is not as bad as with Shift, but also noticeable.
    Is there any solution to this problem? It is a major impediment and I am even considering an iOS downgrade because it is basically killing my ability to work efficiently with my iPad. Otherwise I am kinda okay with iOS 7, but this is a real show stopper. I wonder why I found nobody else on the whole web mentioning this problem.

    Thank you Habitoti for describing the necessary change to the way that we need to type on ios devices to avoid the capital letter problem.
    Holding the shift key fractionally longer solves the problem. But why oh why would Apple require users to fundamentally change the way they touch type by introducing a different keyboarding protocol like this? It is most unlike Apple to have us now have to consciously think about how to touch type all over again.
    Intuitive operating systems are what make Apple so great. This keyboard problem is definitely not intuitive and it is driving me crazy.
    Apple, you need to change the time weighting on the shift key in iOs 7.04.
    Please, pretty please!

  • Keyboard problem with T410 - Control Key

    I have a problem with the control keys on the keyboard of T410.
    I swapped my X200 keyboard over to T410 to check if it is software or hardware issues.  With the X200 keyboard, the 'Ctrl' key is not working.  With the T410 keyboard, 'e', 'd', 'c' and 'Ctrl' keys are not working.

    Welcome to the forum!
    I believe that X200 and T410 keyboards are mapped differently in BIOS.
    Can you find another T410/T510 keyboard to test with?
    Cheers,
    George
    In daily use: R60F, R500F, T61, T410
    Collecting dust: T60
    Enjoying retirement: A31p, T42p,
    Non-ThinkPads: Panasonic CF-31 & CF-52, HP 8760W
    Starting Thursday, 08/14/2014 I'll be away from the forums until further notice. Please do NOT send private messages since I won't be able to read them. Thank you.

  • Really weird keyboard problem with my macbook.

    Hi Everyone,
    I've been having an unexplainable keyboard problem all day now. The keyboard on my Macbook is unresponsive, and the trackpad is stuck on right click. BUT when I plug in a USB keyboard, both my macbook keyboard and my trackpad work after I restart. They continue to work for a little while, but a couple minutes after I unplug the USB keyboard, the both stop working again. I can't seem to figure out what the problem is. Is there anyone out there that has any experience with something like this?
    Thanks!

    If cleaning your keyboard does not help, take the computer to an Apple store or an AASP.  Whichever is more convenient for you.
    How to remove and clean your Macbook Pro Keyboard
    Cleaning Macbook keys after a spill

  • Re: rollover keyboard problem with a Presario C769US

    This Presario C769US  OS Win7 Home 32 bit works just fine except for 1 game that I play a lot away from home.  Like if I have a few hours to kill before a meeting starts.  This older games are simple to play using just the keyboard.  So I don't have to lug around cd/dvd's,  joysticks and manuals.  
    1 game Bio Menace requires certain keyboard cmd's to be entered during game play in order to turn the cheat menu on.  1st  C+A+T   then C+O+D  >  a box opens up and type in 91827 then hit enter.  (Here is were the Rollover cmd error starts)  I next press and hold J+I+M wait a 1/2 second then press space bar.   Then let up all 4 keys at the same time.  If timming is correct The cheat menu pops up.  I checked the keyboard with a keyboard testing prog.  When I press J+I+M everything works fine.  But holding J+I+M down and pressing space bar,  The space bar just doesn't get seen as been pushed.  This is the 2nd laptop that I got.  The 1st one an Acer one laptop had the same kind of keyboard problem.  Now my primary home computer is a Gateway laptop model MD2614U  OS win7 32 bit and that big old Toshiba M60 laptop (before the screen croaked)  is the one I carryed in my backpack.  Now the Gateway laptop and the Toshiba laptop both could handle the J+I+M then space bar cmd with no problems.    Is there any way to fix this rollover problem in the Presario laptop?
    Steve

    Hello @reble1,
    Welcome to the HP Forums, I hope you enjoy your experience! To help you get the most out of the HP Forums I would like to direct your attention to the HP Forums Guide First Time Here? Learn How to Post and More.
    I have read your post on how the keyboard keys on your notebook computer are not working, and I would be happy to assist you in this matter!
    To return the functionality to your notebook's keyboard, I recommend following this document on Notebook Keyboard Troubleshooting (Windows 7). This should help configure the keys on your keyboard for proper use.
    Please re-post with the results of your troubleshooting, and I look forward to your reply!
    Regards  
    MechPilot
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the right to say “Thanks” for helping!

  • Keyboard problem with iOS 8

    Anybody else having problems with the keyboard in iOS 8?  Using iPad Air.  When working with longer documents in email, notes and pages, I can't see what I'm typing after the text goes below the keyboard.  I have to minimize the keyboard click on area after last text, then hit return a lot of times to add blank space where the keyboard is.

    I Think I have the same problem and its only occurred since I updated to iOS 8 actually as I type this I can see the text as i type but on other forums the text box disappears below the keyboard and if I scroll it hides again ! I must be doing something wrong and it's not that obvious and I'm being stupid?
    I'm trying to use a ning forum and the tripadvisor app amongst other places ..... Can somebody help me out please ???

  • Random program and keyboard problems with Leopard OS X 10.5 ,,A Virus?

    I have been using Leopard for about a year now with no problems. I normally only restart my mac once a week as it is so stable compared to my pc's. In the last week I have been having random problems with a program on one screen closing as I close another one. All files in photoshop closing at the same time when I only click one to close. And the keyboard seems to type random symbols instead of letters this continues until I restart then can return after a day or so though today the keyboard started its random symbols only 4-5 hrs after restarting. Has anyone any ideas as to what is going on and how to fix it. Seems like a virus to me.. and there are not a lot of programs you can use to check for problems on the mac as virus's and things are so rare.

    Sorry for the delay in continuing this topic. I was snowed under with work pre Christmas and had to leave the problem until now. However I have got to the bottom of the cause but am still struggling to resolve it. I tracked the problem to the Wacom driver I use for my Intuos 3 tablet. When I checked the about button for the version number I got a little animation instead with a few lines saying it was the wacom engineer monster who liked to cause mischief. and the line "Enjoy using your Wacom Tablet!!
    I deleted the driver and reloaded the latest one from the wacom website, checked the version button and no animation. So I thought I had solved it. But when tonight the keyboard started to type wrong characters again I checked and there it was again. I think this means this piece of malware is hiding on the mac somewhere but where should I look?

  • Anyone NOT having Keyboard problems with newer MBP!

    After reading about all the keyboard problems on the newer MBPs, is there anyone NOT having keyboard lockups or dropping letter problems? Looking to purchase a MBP soon but after reading about the many keyboard problems I will probably postpone or decide to get a different machine.

    There might be a couple of things to try. You could borrow an external keyboard to use for a while--or even buy a cheap one used, and see if you still have problems or not. If you don't, there's likely a problem with the MBP keyboard itself.
    Also, if you have access to an Apple Store, you might be able to make an appointment with the genius bar and get a definite diagnosis. It may be possible to arrange to get in a replacement keyboard at the Apple Store and have them fix it while you wait. Don't know for sure if that would be possible, but it's worth asking. Same with an Apple authorized repair shop--it might be possible to get it fixed without having to send it off.
    Good luck!

  • Keyboard problems with my macbook

    alright so i came home today and found that my cat threw up on my keyboard, and because it was kind of crusty i had to scrub it off, and it's led to several problems with my macbook.
    when i type it won't type letters, it's just symbols and commas, the light doesn't come on when i push the caps key, and when i click on my ichat buddylist, it highlights the entire list.
    and also, when i click on links in webpages, it will download the link to the page as a file onto my desktop.
    is there anything i can do to fix this?

    Macbook keys are laid out different enough that it's not nearly as easy to "pop them off" to clean if you can at all. Beyond some basic cleaning, you can try resetting the following:
    Reset your PRAM: http://docs.info.apple.com/article.html?artnum=2238
    Reset your PMU: http://docs.info.apple.com/article.html?artnum=303319
    Still looks like a hardware issue now with the keyboard, but the PRAM stores information and settings for some keyboard functions and the PMU is a tad more responsible for the hardware functionality.
    Beyond those two resets you'll most likely be looking at having the computer sent in for repair...sadly enough, not under warranty...and you'll be looking at a bare minimum of $350 - $400, as there are flat rate labour and repair charges for repairs not under warranty of $280, and a new keyboard/trackpad isn't gonna be DIRT cheap.
    Sorry for the bad news, but this is why I trust my cats with nothing.

Maybe you are looking for

  • Programmatic expense report interface?

    I am trying to enter expense reports into ERP 11.5.9 programatically. I went down the path of using the Invoice Gateway, but I ran into a snag when our accountants mentioned that the invoices I am entering are tied to an employee (i.e. an expense rep

  • How do I identify a problem in an event?

    Friends, I've updated to FCP X 10.1.  An event that I created after updating and for which I created a project suddenly displayed a yellow hazard symbol next to the name of the event.  This suggests that there is some sort of problem with the event o

  • Audio passed through to TV

    Hello, I'm new to this forum, my apologies if this question is already posted before. I just bought a Mac Mini today, it is attached to my Onkyo receiver through HDMI. When I look at the output settings of my audio I can only choose for internal spea

  • Message output type NEU in contracts

    Hi. In my system I have deleted all the condition record for all the key combination for document type MK,WK contracts. Still the system fetches the NEU message time at the creation of the Contract. Can you please tell me if there is any setting / Us

  • Error- while trying to join documaker workspace.

    Hi All, We are trying to one of documaker workspace, but getting an error "Userinfo file unable to open". So I' m requesting you to what would be probable reason to pop up that error. Thanks in Advance.