• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Trying to Popup a new JFrame

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

    reply
      Bookmark Topic Watch Topic
    • New Topic