Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting string from textarea in scala

 
phillip nash
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all!

I'm starting out learning how to use scala, but I'm finding the transition very tricky.

I'm writing a simple application where I enter text in a TextField and when I click "Show" it shows the text within the TextField
within the console.

In java all I need to do was to use ".getText()" to the the text from a JTextField.

How can I do this in scala? Or is it even possible?

Thanks
 
Mohamed Sanaulla
Saloon Keeper
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you provide the code you are trying?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15482
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it's still a JTextField, then you can do exactly the same in Scala as you did in Java - just call .getText() on it to get the text.
 
Marimuthu Madasamy
Ranch Hand
Posts: 72
Java Monad Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using Scala swing's 'TextField' http://www.scala-lang.org/api/current/scala/swing/TextField.html, you can use 'text' method on the TextField to get the text.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic