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


Victoria Preston
Ranch Hand

Joined: Feb 03, 2006
Posts: 106
I am having trouble attaching listeners to my gui. Here is my my code for the gui

If you run the program you see I have two text field. one for input and one for the output. I am suppose to take the text in the input field and calc using my calculation class.

Can anyone help. I know I did not explain it well. Just tell me what you need to know
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
calc.addActionListener(new ButtonListener());

but this part doesn't look right
Scanner sc = new Scanner("\\.*");

as you are reading from and outputting to the textfields, perhaps it should be

assuming p.parseExpr(..) returns a String,and you would need suitable error
handling for an empty input
Victoria Preston
Ranch Hand

Joined: Feb 03, 2006
Posts: 106
thanks I have it working now... you were right.
I agree. Here's the link:
subject: listeners
It's not a secret anymore!