• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Help with understanding ActionListener

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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: 65457
248
  • Mark post as helpful
  • send pies
  • 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.
 
I was born with webbed fish toes. This tiny ad is my only friend:
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!