This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How can I store user input from GUI into a text file?  RSS feed

 
drew taylor
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have spent ages trying to get this to work. I'm trying to store the value of a textBox into a textFile when the button is clicked.

Instead of out.println("This is line 1"); would I use something like:

out.println(textBox.text) ??

 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

it would've been useful for others to explain what a "textBox" is in your application. Obviously it's not a real Swing type but I guess it's something like JTextArea or so.

Anyway all JTextComponents (of which textBox is hopefully derived) have a write() method which takes a Writer object and stores the data model of the text component as plain text to this writer. Perhaps this is what you're looking for...

Marco
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!