aspose file tools*
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
Author

listeners

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(System.in).useDelimiter("\\.*");
...
p.parseExpr(sc);

as you are reading from and outputting to the textfields, perhaps it should be
output.setText(p.parseExpr(input.getText());

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: listeners