This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Lotto generation

 
Alan Green
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having trouble with my action command. I am trying to use get.Source to activate the generation of the numbers when i hit play. Is there an easy way of doing this. Thanx..

 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you keep asking Swing questions in other forums besides the Swing forum?
I moving this thread to Swing. Please pay close attention to what forums you are posting questions in. You will get faster, better help by doing so.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I asked if you would change your display name to conform to our Naming Polciy. Although you did change your display name, it still does no comply with our naming policy.
In case it is not clear enough in the link I provided, you have to use a First Name Last name combination. See my display name for an example.
Members who fail to comply with this rule risk having their account disabled. Consider this your last warning.
As soon as you have complied I will be more than happy to help you with your problem.
I hope that you understand, this is for the benefit of the entire Javaranch website. We are not picking on you. I hope that you will comply soon. This is a wonderful place to learn Java and meet with other professionals around the world.
 
Alan Green
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no problem
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for changing your name!!
As to your question. event returns an object. In your case, that object would be a JButton more than likely. So what you need to do is possibly something like...

or you could do

Either way, you are going to need to make your playButton public for this class so it can be used in your actionPerformed method.
Hope that helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic