Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Import txt file in AbstractTableModel  RSS feed

 
Mirvat El-Dassouki
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.
 
Steve Luke
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!