The idea is that i have got an ActionListener that when the user presses on the button it checks a couple of varibles in the main method with if commands and it will eventually find one that is true. At which point it sets a String. The String is differrent everytime, however the oporation i want preformed on the String is the same everytime. i was wonderring if i could refferrence to a method in my code rather then just repeatting the same piece of code 7 times in my project.
this is a cut down version of thye code to show what im trying to achieve
From what I can see, that looks OK -- but why create a new "Genarate" object. Since actionPerformed already belongs to the Genarate class, you can call the method directly on the (implicit) object that's already doing the work; ie.,