This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Import txt file in AbstractTableModel  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
first of all my mother tongue is not English so forgive me for my mistakes.
I have a AbstractTable and would like to import a txt file into it. I know how to do it for a Default Table but I am not allowed to use it.

now there is another method, which should import the chosen file into the table.

What do I have to do to import the file into the table?
I would be really happy if you could help me.
 
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The basics are:
1) read the file from the disk
2) break it up into the parts you need based on how the data is structured
3) stored the data in a structure that fits the data
4) Send the data structure to your table model
5) Have your table model interpret it into rows and columns

For help see:
- IO Tutorial: http://docs.oracle.com/javase/tutorial/essential/io/
- Collections Tutorial: http://docs.oracle.com/javase/tutorial/collections/
-- though you might also consider basic Object Oriented design first, create a Class which represents one Row in the table, then put instances of that class into an appropriate collection
- TableModel Tutorial (with example AbstractTableModel): http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#data
 
Mirvat El-Dassouki
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. Those links were really helpful.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!