Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown


Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created JTable which reads the data from a File using FileChooser.
The only thing which is working for me is that I have to ask user at command prompt to choose the file which has data. Once they choose the file I am able to show the Table in a frame with and a menu i am using the AbstractTableModel and a Vector to store the column headings and data in Vectors from file.
What I want to do is Open a frame with buttons and menu and empty table and when user clicks on menu's open option to open desired file then show the data in Table.
After that when user does any changes I will chack and again user can save the data in a file using FileChooser. This is working for me.
Only place I need help is how to show the empty table and then fill the coulmn of tables from file data.
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you can do is, you can fill the table with empty data, may be with "" initially and then you can change it when user chooses a file with data.
- Raja.
Swati Gupta
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot. I was afraid that I will have to do this. But finally I did that.
Now its working except few things.
Should I use firetableDataChanged() somewhere.
2) I had a scrollbar in the frame. Now that Scrolbar does not show up if the number of rows are more then the area defined.
This was initially where MyTableModel is the AbstractTableModel
MyTableModel myModel = new MyTableModel();
JTable table = new JTable(myModel);
table.setPreferredScrollableViewportSize(new Dimension(700,150));
JScrollPane scrol = new JScrollPane(table);

After the values are changed I am using
new MyTableModel();
If somebody says you look familiar, tell them you are in porn. Or in these tiny ads:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic