JButton is Focused but not clicking ...Why??

Hi evey body:
Can you please help me with the JButton problem ...??
I give it the focus using requestFocus() but when I press Enter from the keyboard it doesn't click???
JButton Btn = new JButton("Ok");
Btn.requestFocus();
Btn.addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent evt)
JOptionPane.showMessageDialog(null,"Error in user Name and Password ..try again");
Thanks in advance

YOu have to check the Key, try something like that
Btn.addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent evt)
if ( (e.getKeyCode() == KeyEvent.VK_ENTER)) {
// DO what ever you want to do

Similar Messages

  • HT201317 On a recent vacation, only some of my photos taken on iPhone appeared in photo stream on my iPad but not all, why?

    On a recent vacation only some of my photos take on iPhone appeared in photo stream on iPad but not all why?

    The iPhone forum is here
    https://discussions.apple.com/community/iphone

  • My trackpad is not responding properly on MacBook Pro.  Can move the cursor but not click on icons or similar items.

    My trackpad is not responding properly on MacBook Pro.  Can move the cursor but not click on icons or similar items.

    Intel-based Apple Portables: Troubleshooting unresponsive trackpad issues

  • Apple today expands the itunes store to reach new 53 countries ... but not MOROCCO why !!!! even the iphone 5 will be released in 21 december in morocco ..

    apple today expands the itunes store to reach new 53 countries ... but not MOROCCO why !!!! even the iphone 5 will be released in 21 december in morocco ..

    new software that could be released through the iTunes online store for late December or early January, which was the iOS 6.0.2, wasn´t it?
    No. The iOS 6.0.2 update was only to address issues with the WiFi chipset in the iPhone 5 and iPad mini. Whether a future software update will add LTE support to existing iPhone 5 units, none of us here can say.
    Regards.

  • Why cant I add songs in my itunes library.  I can still add movies but not music, Why cant I add songs in my itunes library.  I can still add movies but not music

    Recently, I can no longer add songs in my itunes.  I can delete it or move the songs into playlist but adding songs doesn't work anymore.  I can still add photos and movies but not music.  Please help me solve this issue.

    I have a master iTunes file that contains all the music that I or my children have bought and then my own collection within the file. That song, 'Mercy, Mercy Me/I Want You' is gone from both lists
    Nabitnak,  Not sure what kind of master file you are keeping, but the song file is probably in your backup.
    Why is that song not available on iTunes? I can get it on Amazon.
    The iTunes Store, like any retailer, does not have 100% of all existing items.  But anyway, if you can buy it on one store, it hardly matters why another store does not have it.
    The coincidence of my missing song and iTune's missing the same song is beyond suspicious.
    Maybe, although if you have a backup it should be there.
    To address the other part of your question, "I can find it on You Tube, why not iTunes?":  Youtube has content that is uploaded by users.  Music retailers such as iTunes have content that they are licensed to sell as downloads.  The two things have nothing to do with each other.

  • Can a JButton be unclickable but not disabled?

    The reason I ask this I want the button to be basically disabled but not to lose it's color properties. I have a simple tic tac toe game but I want the X's and O's to be colored, if I set the buttons to disabled they lose their color.
    Thanks,
    Mike

    I'm bored, so here
    import java.awt.Color;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    public class Test extends JFrame implements ActionListener {
         JPanel pnl = new JPanel(new GridLayout(3,3));
         JButton [] btn = new JButton[9];
         int player = 0;
         Test () {
              setBounds(200,200,300,300);
              for(int i = 0; i< btn.length; i++)
                   btn[i] = new JButton(i+"");
                   btn.addActionListener(this);
                   pnl.add(btn[i]);
              getContentPane().add(pnl);
              setVisible(true);
         public static void main(String[] args) throws Exception {
              Test t = new Test();
         public void actionPerformed(ActionEvent e) {
              // TODO Auto-generated method stub
              JButton b = (JButton)e.getSource();
              if(b.isSelected())
                   return;
              else
                   b.setSelected(true);
                   b.setBackground(getColor(player));
                   player = player == 0 ? 1 : 0;
         private Color getColor(int player)
              if(player == 1)
                   return Color.BLUE;
              else
                   return Color.RED;
    ~Tim

  • Component that is focusable, but not focus- traversable

    Hi,
    I have found a tidy solution to this, and posted it in the thread I thought was most appropriate, THEN I found, it was in the REFLECTION forum - duh.
    I won't cross post the whole solution here.
    So if you're interested, bowl over there for the answer
    http://forum.java.sun.com/thread.jspa?messageID=3541807&#3541807
    Cheers
    Bruce

    Answer,
    I have a status field on my dialog that shouldn't be keyboard traversible, but I would like the user to be able to cut the contents (such as an error display), so I need to be able to have it focusable by mouse click.
    I did this by enclosing the component inside a focusCycleRoot container that isn't itself focusable !!
    original code, status widget gets focus when traversing via keyboard.
            JTextField status = new JTextField();
            status.setColumns(40);
            status.setEditable(false);
            status.setFocusable(true); // So user can cut the text with mouse
            status.setBorder(new javax.swing.border.EmptyBorder(status.getInsets()));
            container.add(status, "layout stuff");This is the modified code, which stops status being traversible by keyboard.
            JTextField status = new JTextField();
            status.setColumns(40);
            status.setEditable(false);
            status.setFocusable(true); // So user can cut the text with mouse
            status.setBorder(new javax.swing.border.EmptyBorder(status.getInsets()));
            Container statusTraversalHider = new JPanel();
            statusTraversalHider.add(status);
            statusTraversalHider.setFocusCycleRoot(true);
            statusTraversalHider.setFocusable(false);
            container.add(statusTraversalHider, "layout stuff");

  • Team membership invitation sent, accepted, but not active, why not?

    My Admin user licenses page displays status as "Invitation sent" but not showing as active.  How do I get it to show it as active?
    Mac OS 10.9.5
    CC 2014
    Firefox 34

    As far as I know, this Cloud forum is more about individuals
    Team license links that may help
    -http://www.adobe.com/creativecloud/buy/business.html
    -team plans https://creative.adobe.com/plans?plan=team
    -manage your team account http://forums.adobe.com/thread/1460939?tstart=0 may help
    or
    This is an open forum with a mix of program users and Adobe staff, not Adobe support... you need Adobe support
    Adobe contact information - http://helpx.adobe.com/contact.html may help
    -Select your product and what you need help with
    -Click on the blue box "Still need help? Contact us"

  • Mouse has focus but not keyboard

    Every once in a while I will be in an application - at least my mouse works in that application, but my keyboard doesn't appear to be working. Then I look at the title bar, and even though my mouse is making my Firefox or iTunes scroll like normal - the title bar says I'm running Mail.
    So I tab over to the application my mouse thinks I am in, and now my keyboard and mouse are using the same application.
    This happens maybe once a week or so, and I haven't been able to do it on command.
    Is this a known issue?

    Howard Brazee wrote:
    Every once in a while I will be in an application - at least my mouse works in that application, but my keyboard doesn't appear to be working. Then I look at the title bar, and even though my mouse is making my Firefox or iTunes scroll like normal - the title bar says I'm running Mail.
    So I tab over to the application my mouse thinks I am in, and now my keyboard and mouse are using the same application.
    This happens maybe once a week or so, and I haven't been able to do it on command.
    Is this a known issue?
    On my MacBook I can use the trackpad to scroll (with two finders) a window of an application that's not "in front". I consider the ability to scroll a window that doesn't have "the focus" to be a feature, not a bug. If you want to give the window of that other application the focus, just click in it.

  • SMS Messages--can send but not receive--why?

    I can send SMS messages from my desktop or laptop through the Skype webpage, but if someone tries to respond, they get an error message that says, "failed message".  Why can I not receive SMS messages back to my Skype account online?

    OK, so who is paying for it?
    I would make sure that you have the personal BIS account enabled on your carrier account.
    Look at Options > Security > Information. What is listed there? See the RIM Knowledge Base article here for information on how to remove an IT Policy. See the Method Three in the link: KB14202 How to remove an IT policy from a BlackBerry smartphone
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Keynote PDF Export - black text appears white on some computers, but not all - why?

    This problem seems to have been going on forever, why is there STILL no solution? I'm really keen to mover over to Keynote, cos Powerpoint is very cumbersonme and frustrating in my experience, but I'll only ever use Keynote to export PDFs for presentations, so if it can't even get this basic function right, there's really no point in abandoning Powerpoint - at least I know my docs will come out fine and won't have to be embarrassed when clients come back to me frustrated cos they can't read the text!
    Any thoughts?

    That would because some of the colors you are using are RGB and are being converted to cmyk.
    Make a color swatch in the Color specifier and set the ICC profile in the small rainbow square next to the pull down menu in the color sliders tab.
    Then use that color swatch in set styles to ensure you have the same color set on all your objects and text.
    You should not be using jpegs if you want to ensure an exact color. jpegs are not suitable for flat areas of color.
    Peter

  • Simple JS works in Acrobat 7, but not 8 - why?

    I have a simple form with 2 fields: "myname" and "phone". "myname" is a drop down list populated with 3 names. I want to be able to populate the "phone" field with a phone number corresponding to the "myname" field automatically.
    I have the following JS attached to the calculate event of the myname field. This works perfect in Acrobat 7.0.9, but does not work at all in Acrobat 8.0 professional or Adobe Reader 8. Does anyone know why?
    switch (myname.rawValue){
    case "Beth Voigt" :
    phone.rawValue = "431-3833";
    break;
    case "Bobbie Hartfiel" :
    phone.rawValue = "431-2019";
    break;
    case "Dave Brown" :
    phone.rawValue = "431-2448";
    break;
    default : phone.rawValue = "";
    event.newText = myname.rawValue;

    I was just asking where those scripts are located.
    You can configure Chrome to use Reader instead of its built-in viewer: http://blogs.adobe.com/vikrant/2010/12/use-adobe-plugins-to-view-pdfs-inside-google-chrome /

  • Translation of parameters but not showed - Why ?

    Hello,
    there's a program write in deutch language.
    I translate it from DE to FR, and than from FR to IT.
    All it was ok.
    Now I make some modification in IT language: I mean the I changed some texte in IT, I actived the new text, but
    when I run the program in IT, the text is not reprised, is showed the parameter's technical name.
    Why ?
    What I have to check ??
    Tks,
    I translated some parameters in a z reports, but when I run the program

    no reply

  • My table header row repeats on page 2, but not thereafter -- why?

    The header row on my dynamic table will repeat when the table overflows onto the second page, but if it flows over to a third or fourth page, the header does not repeat.  Why is that?  I'll be happy to send the form with the troublesome table via email to someone who can help,
    Thanks,
    Jenny

    hi, its weird !!
    pls fwd it to [email protected]
    Abhinav

  • Bluethooth Mouse can scroll but not click

    Hi All,
    I was searching around the disucssion groups and I hope I did not miss a solution for my problem - so, if I double the problem submission I apologize!
    I have a weird issue and apparently Apple support cannot help as well.
    I recently bought an iMac 24 and added to it the bluetooth mighty mouse as well as the bluetooth keyboard, both worked fine and I love the functionality (once you know the keyboard shortcuts) and the design.
    After a week or two the bluetooth mouse kept scrolling but did not accept any left or right click anymore. I deleted it from the bluetooth device list, set it new up, but it did not help! I talked to Apple and they assumed the mouse was broken and offered to send a new one, which I received next day. The new mouse was installed next day and worked since then. This morning I was setting up some copy processes to a new external HDD and all over sudden, the bluetooth mouse keeps scolling but does not accept any click anymore. I set it new up, reinstalled both keyboard and mouse in different install orders, but nothing works - still the mouse only scrolls but does not accept click.
    Does anybody have any idea what the problem might be and can be resolved - any help is HIGHLY appreciated!
    Thanks

    Hi! I have same problem.
    Before install Leopard my MMouse (arrived with the new iMac)
    func. very well! No problem!
    Then i have installed leopard!
    For the first week (or for some day, i don't remember)
    mouse work...
    Them mouse start to have problem.
    Central and side button don't func.
    I also have to add that mouse have problem
    to connect to mac, sometimes, when i start mac.
    I try to reinstall mouse but no solution.
    I also try to install another Mighty Mouse from my other mac... no way.
    I reinstall tiger and all is ok!
    I must say that Mouse pref. panel
    Don't show mouse name or battery status!
    I think is a bluetooth problem of leopard.
    Someone can help we???

Maybe you are looking for