File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes calling a button from utility file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "calling a button from utility file" Watch "calling a button from utility file" New topic

calling a button from utility file

gary davis

Joined: Nov 15, 2003
Posts: 7
I created a utility file named AntoniosUtilityFile
public String reverseThisString(String toReverse)
return new StringBuffer(toReverse).reverse().toString();
I want to be able to click on a button called reverse in my main class
and it will access the information in my utility file.
public class Memo
public void actionPerformed(ActionEvent e)
if (actionCommand.equals("Reverse"))
"do something here to acces AntoniosUtilityFile"
"which will reverse the text once the reverse "
"button is clicked."
S Rubia

Joined: Apr 06, 2003
Posts: 23
well gary,
all i understand is that u had a file named which has a method named reverseThisString and u want to call it from ur class in actionPerformed method ...
If this is right then it is simple in actionPerformed
1-- make an object of ur AntoniosUtility class object as
AntoniosUtility obj=new AntoniosUtility();
(if there is default constructor)
2-- by this object call the required method by the passing String u want to reverse,and store the result in another string or directly displaying it whatever u want
String result=obj.reverseThisString(String);
I agree. Here's the link:
subject: calling a button from utility file
It's not a secret anymore!