• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Vector and JTable

Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ranchers again!
first of all i wanna thanks Greg for his help.
I had posted a problem with a JTable a fiew days ago:
My code was:
public class TableDeamon implements ActionListener{
private Object columnnames[];
private Object data[][];
private JTable table;
private Container c;
private JButton cancel,save; sigouro an einai oristika ayta
private JPanel buttonPanel;
public String Title="New Window.";
private JFrame frame;
private int returnXlayout, returnYlayout;
public String TableName;

public void setup(int Xsize,int Ysize,int CloseOperator){
frame=new JFrame(Title);

table=new JTable(data, columnnames);
c.add( table , BorderLayout.CENTER) ;
c.add( new JScrollPane ( table ) );

With this code i wanted to add a row during on runtime, by pressing a button.The row i wanted has not values.

Greg suggested me to use DefaultTableModel, store data in there and then add to table the dtm (Default Table Model) to JTable.

I used .table.DefaultTableModel import and worked, but i cant saw the empty new row by clicking my button (and using the dtm.addNew() method).I tried to use Vector but i had no result!

Please give my your help!

Thanks to Greg ,

Thanks anyone for your help, if any!
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

you could try implementing your own TableModel as a subclass of DefaultTableModel (untested):


The happiness of your life depends upon the quality of your thoughts -Marcus Aurelius ... think about this tiny ad:
a bit of art, as a gift, the permaculture playing cards
    Bookmark Topic Watch Topic
  • New Topic