This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Dead buttons  RSS feed

 
John Brookes
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recently had a problem adding a "reset" button to a GUI I've been modifying. You can see the original problem in this thread.

As it hints in that thread, I'm now having problems with other buttons on the GUI. I've removed most of the "static" identifiers that the program was using and changed it so the program calls instances of GUI(), rather than just GUI() itself. Now I have two other button panels that have stopped working (although everything compiles, it's just the buttons don't register any events).

The code is in the old thread if you need it, but if you need to see any more just ask. Can you spot any obvious problems in PromptPanel? Whatever is causing the problem here is almost certainly identical to the problem in the other class which I haven't posted to save space.

Cheers.
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
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
Not to take away from Craig's contribution, but...

The major problem I see with the linked-to code is that PromptPanel's "gui" member is never initialized. You changed one class to take a GUI object as a constructor argument and initialize a member, but in PromptPanel, you added the member but neglected to add the constructor argument and initialize it. So pressing that "confirm" button probably gives you a NullPointerException.
 
John Brookes
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aah yes I've got you. Let me give it a try...
 
John Brookes
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup, all sorted. Found some other related problems which I actually managed to figure out myself

Would you believe, barely a year or so back, I used be a damn-fine Java programmer? This is what you get for not practicing.

Anyway, thanks for the help guys - no doubt I'll be back with more before the end of the week :roll:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!