• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get a value from actionPerformed method to normal method  RSS feed

 
Prabhash Ranjan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


i want price value in normal mehod.
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to be able to use price in another method, you need to call that method with price as a parameter:


(although, actionPerformed is just a normal method, so I don't know what you mean when you say 'i want price value in normal mehod')
 
Campbell Ritchie
Marshal
Posts: 56533
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
I have added code tags and you can see how much better your post looks. Also, don’t use tabs for indenting: spaces only.
Using the source in an actionPerformed method suggest you are not writing proper object-oriented code. You associate the listener with a source by adding it directly to the Component.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!