File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

listeners

 
Victoria Preston
Ranch Hand
Posts: 106
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 106
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks I have it working now... you were right.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic