• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

How to capture text typed in TextField to .txt file, by button click?

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to capture text typed in TextField to .txt file, by button click?

               grid.add(new Label("Nome:"), 0, 0);
TextField txtNome = new TextField();
GridPane.setHgrow(txtNome,  Priority.ALWAYS);
grid.add(txtNome, 1, 0);

               HBox buttonBar = new HBox(5.0);
       buttonBar.setAlignment(Pos.CENTER_RIGHT);
Button btnGravar = new Button("Gravar");
 
Master Rancher
Posts: 4223
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you got any event associated with that button?

That's the first step.

Do you know how to write to files?
 
Sheriff
Posts: 6191
164
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you post code, be sure to UseCodeTags (that's a link) and format your code.
 
André Fagundes
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can capture to file but it is in java, and it is not working in FX, I can program events but I am not finding a code that captures from textField and writes to local file.
 
Sheriff
Posts: 24635
56
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

André Fagundes wrote:not working



This could mean anything from "I don't know what code to write" to "My app crashes and then I have to buy a new computer". Could you be a bit more specific about what you can do and what you can't do?
 
Dave Tolls
Master Rancher
Posts: 4223
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

André Fagundes wrote:I can capture to file but it is in java, and it is not working in FX, I can program events but I am not finding a code that captures from textField and writes to local file.



FX is Java.
So if you have code that writes to a file, then do you have an action associated with the button?
A method that is called when the button is clicked.
 
I yam what I yam and that's all that I yam - the great philosopher Popeye. Tiny ad:
Enterprise-grade Excel API for Java
https://products.aspose.com/cells/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!