This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 246385 - Key event for enter key and space key are equal when compared
Summary: Key event for enter key and space key are equal when compared
Status: RESOLVED INVALID
Alias: None
Product: java
Classification: Unclassified
Component: Beans (show other bugs)
Version: 7.0.1
Hardware: PC Windows 8
: P3 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-11 07:13 UTC by Sreekrishnan
Modified: 2014-08-11 11:21 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sreekrishnan 2014-08-11 07:13:16 UTC
int key=evt.getKeyCode();
    System.out.print(key);
    if(key==KeyEvent.VK_ENTER){        
        JOptionPane.showMessageDialog(this, "Hello world");
    }


When keys Enter is pressed a dialog box will be open. But when space key is also pressed the same dialog box will be open.Please help me to solve this bug.
Comment 1 Jiri Prox 2014-08-11 11:21:41 UTC
This problem is related to java codding not NetBeans, so I'm closing it now.

But anyway the code you've provided should work correctly for enter, at is works fine for me. Maybe you have another condition somewhere in the code. It is hard to tell without whole class source.