• 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

Help with understanding ActionListener

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am trying to implement user input in my dice rolling program but I do not understand where I need to add the actionListener. What I want the program to do is allow the user to click on each roll button and have the output be between 1 and 6. I figured I can put it in the "main" class due to the size of the program but I would like to know the best way to go about adding the actionListener into a sub-class for practice purposes.

-Thank you

Here is my code thus far:
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't try to implement an application on the GUI. Have you got the application working without a GUI?

Never write an empty catch; you will miss the Exception thrown because you have a comma rather than a dot in the middle of the look'n'feel name.
 
reply
    Bookmark Topic Watch Topic
  • New Topic