Hey guys, Writing a project for school and having a little trouble. We are creating a social media program and the teacher never taught us to use databases so we have to store all the data in text files. One of the requirements is to for the users to be able to "create a group". While creating the group the user will select users to add to that group. I have created a frame that diplays available users and displays them in a table. What i need to do now is create an actionlistener so when the "save" button is hit, it will take ALL ROWS AND COLUMNS that are selected and write them to a text file. I cannot figure out for the life of me how to add this action listener. There is a lot of different source files but the only ones that requires concern is the CreateGroup.Java page.


JTable has the similair structure as

  • Database (column names and row)

  • original xml structure is about (similair to) databases or Tree structure

  • plain csv file (acceptable by MsExcell as well), there are a few codes how to export JTable to MsExcel (JTableHeader and rows too), its only about iterating into TableModel (and vice versa add from File)

thank you sir however that did not answer my question. What would the actual SYNTAX for copying MULTIPLE SELCTIONS from a JTABLE to a TEXT FILE. Please let me know how i would do this with an action listener if possible


Maybe you misunderstand what we do here. We are not a homeowrk service.
There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in helping you cheat or doing your homework for you.

mKorbel has pointed you in some good directions. Go away and do some work yourself before coming back here and asking for more help.

How in the world was i asking him to do my homework? I asked for help with ONE task. Did I ask him to write the entire social media project for me? NO. I was simply trying to specify what i needed to do. He pointed me in the direction of exporting to a CSV file when I specifcally said TEXT. I am appreciative of his time but it did not help. Clearly you are not about helping me either, u just want to knitpick responses. Why dont u go away and read what i said the first time before telling me I am asking someone to help me cheat!

And obviously I had done all the research I could myself and thats how i ended up here. Didnt know i was going to get a thrashing from the moderator for asking for help. Why dont u just call all of your users "idiots" and have them be on thier way. Ill make sure to spread the word on how "helpful" the moderators here are!

I didnt even ask him to write syntax specified for my code, just IN GENERAL, what would the syntax look like. READ MODERATOR, READ! Useless ass