• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with Table

 
nikos sokaf
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ranchers!!!
I have a problem with a JTable...
Here is a part of my code:

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);
frame.setSize(Xsize,Ysize);
c=frame.getContentPane();
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);


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


this is a part of my class that i parse some datas from a database to
this JTable.

I'm trying to do this:
My data loaded normally on my Table from database.
The number of rows depends from the RowCount of database's recordset...
When the user's focus is on the last cell of the table, and Hits ENTER
I want to my table add's a new Row with no Values...

If this is difficult then how can i add a Row (with no values) on my JTable by clicking a button...

This is my problem , i am confused, so please give me a hint...

Thanks for the help, if any!
This code maybe help other java-ranchers I'm sure!!!

Farewell!!!
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I deleted the post that Ernest moved here. Please do not cross post questions in multiple forums.
 
nikos sokaf
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok!
I won't any time...
Please, now I am on the proper forum!
Please could you give me an idea?

Thanks!
 
Eddie Vanda
Ranch Hand
Posts: 283
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
change:

To:


Then when you determine that you need a new row call:

You need the View/Model architecture to be able to add a row.
 
nikos sokaf
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I wanna thank you for your help.
This tip you post worked perfectly on my code! Thanks again!

nikos sokaf
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!