• Post Reply Bookmark Topic Watch Topic
  • New Topic

Trying to Popup a new JFrame  RSS feed

 
Chris Weaver
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, before you rip me for the code below, I'm just learning this stuff...
I'm trying to display a table and then allow the user to click on a line and pop a new window up. (got that far). the problem i'm having is detecting the button clicked in the new popup.

Any help would be most appreciated.

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
3 problems to fix and the code should work.

  • You never impplement ActionListener on SimpleTable. Put a comma after ListSelectionListener and add ActionListener
  • eatMe method does not need to be static. Remove static from that method.
  • In the eatMe method you create a new JButton then in the actionPerformed method you try and modify that object's text. The scope of button is only for the eatMe method. You can either make button global to the entire class or you can do something like the code below



  • Hope that helps. Here is your code with the solutions I mentioned.

     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!