This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

My program keeps getting halted  RSS feed

 
Adrian Lee
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone. I'm currently facing a problem. My program keeps getting halted whenever I tried to test run. However, When I compile and run it, It doesn't give me any errors. Can anyone advice me where I could have gone wrong? I've many version of the program. This is the earliest version that is giving me same problem.

Program Description:
A GUI that responds to keypress.
Upon running, It opens up a new frame(sample). There's 3 buttons in it. You can navigate (up,down,Escape and Enter). User can navigate between this two frames.

Upon selecting Movies button and pressing Enter. It will open up a new dialog(MoviesMenu). Upon testing the frames(opening up and exiting(press Esc) a few times). The program somehow come to a halt.

Attached below is the codes that I'm using.



Please advice. Thanks Alot!

Best Regards
Adrian Lee

[ June 21, 2007: Message edited by: Adrian Lee ]
[ June 21, 2007: Message edited by: Adrian Lee ]
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On a quick glance through the program, I see at least two keystroke handlers registered for the escape key: one which disposes a frame, and the other which calls System.exit(). If by "halted" you mean the whole program quits, then it seems logical to assume that this key handler is being invoked. I'm not going to examine the code in detail to find when this would happen, but it probably depends on the focus component, so precisely when you press escape will matter.

If I were using a program which exited without even a warning when I pressed Esc, I'd be confused, if not outright angry. Just remove that handler altogether.
 
Adrian Lee
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ernest. Thanks for the reply. The program got halt as in the display is still there except that the program no longer respond to the keystrokes that I'm pressing.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So maybe it's just that with all the hiding and disposing, the front window ends up without the keyboard focus. Have you tried clicking in the window? Do the keystrokes work after that? Have you tried using "requestFocus()" to send the keyboard focus to the newly created window?
 
Adrian Lee
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ernest. Sorry for the unnecessary thread I've opened.

Yes, I've tried to use my mouse to click the frame. But it does not seem to have any effect. At the same time, I am using the requestfocus() to gain focus for my buttons. Still no progress though.
[ June 24, 2007: Message edited by: Adrian Lee ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!