• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JButton action not called

 
Ranch Hand
Posts: 77
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I have added JButton in my panel. Further I have added actionlistener for that button as well.
My problem is when I click on the button actionPerformed() method is not called. And if I move to that button using keyboard and press space, at that time actionPerformed() method is called.
I am executing the program from Eclipse. I tried with rebuilding, cleaning option of eclipse
Even I restarted eclipse and my machine but could not get rid of this problem
Can anyone help me out?

Thanks
Imran
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> Can anyone help me out?

create a new project
add a button to a frame
add an actionListener to the button
compile run
if it has the same problem, post that code

if it compiles/runs OK, keep adding things until it displays the problem
 
Imran Vohra
Ranch Hand
Posts: 77
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I had created sample application but its working absolutely fine.

Thanks
Imran
 
Imran Vohra
Ranch Hand
Posts: 77
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found something else to add.
Its not only about button action thing.
Even I click on textfield, focus is not coming on textfield.
When I click on combo box, its not showing the values it has
But when I take control from key board its working.

So, with mouse there is some problem in accessing controls but I can access easily with key board.

One more thing, it was working fine earlier and stopped working one day when I start my eclipse.

Thanks
Imran
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if you're sure it's a program problem, and not that your mouse is erratic i.e. other programs work fine with mouse,
write a small program, just a JFrame with panel, panel with button/textfield and listeners.
make sure it displays the problem you've described, then post that code so we can see/test it.
 
Imran Vohra
Ranch Hand
Posts: 77
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sure it's not program problem but some other issue. May be some setting issue. Because the same code is working fine on my peer's machine.
I expect some hint from you that what could be wrong on my machine? Like version mismatch or something like that

Thank
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> May be some setting issue

can only help if it's a swing problem
if you think it may be an eclipse issue, perhaps the IDE forum might be worth posting in
if its an OS problem, General Computing might be the Forum
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Imran Vohra wrote:I am sure it's not program problem but some other issue. May be some setting issue. Because the same code is working fine on my peer's machine.
I expect some hint from you that what could be wrong on my machine? Like version mismatch or something like that



My guess: you have a bug in your code. We'll probably be able to give you better help if you can create and post an SSCCE.
 
Imran Vohra
Ranch Hand
Posts: 77
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got the solution
It was JRE version issue.
I was executing project with JRE6 and it was giving me the problem.
Once I change it to JRE5, my problem is solved

Thanks for your help

Thanks
Imran
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for posting the eventual solution - hopefully others with similar problems will be able to find this thread.

I know I'll point them here if I come across similar sounding problems
 
reply
    Bookmark Topic Watch Topic
  • New Topic