Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

How can I get the users input?  RSS feed

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
In this piece of code it reads in a file (work.csv), and then counts how many rows are in the file, which is fine. but I want to be able to get the users input so they can read in what file they want. ie when the user types in the directory of there file, the JTable rows will then resize to the amount of rows in there file. At the moment the code is always set to read in the work.csv file.
Could someone be so kind and help me solve this little problem
Thanks
Ben
 
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If all you need to do is get a file name from the user, just use the JFileChooser.
 
ben riches
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Nathan,
I am having great trouble construsting and using this class in my currnt code could you please help me.
Thanks
Ben
 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is it that you are having problems with? What have you tried and what is happening. The link Nathan gave you is to the tutorial on using file choosers.
 
ben riches
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Paul,
Well the problem I am having that I do not want to use the file chooser,
All I want to have is a text field where the user can type in there file that they want to upload. After they have typed in the file name they then can click a submit button to read in the file, with this reading in of the file, the JTable rows need to change to the size of how many rows are in the file. the number of rows in the file is stored in a int called num.
Hope you can help.
Thanks
Ben
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!