• Post Reply Bookmark Topic Watch Topic
  • New Topic

jtable rendering problem  RSS feed

 
seema prakash
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have problem in displaying the default AND values in the combo boxes in the table.

The table in its empty state, that is when it is contructed and before
the user has a chance to make any changes, a row with no data and 2 columns is created.

The table looks like:

(empty)|(empty)

When the user hits the button once, the new row is added at position
0 in the table and the row that was created first without the user
hitting the button moves down.
Now the table looks like :

(empty)|(some value)
(empty)|(empty)

When the user hits the button the second time, the new row
is added at the last but one row and the table looks like :

(empty)|(some value)
AND|(some value)
(empty)|(empty)

When the user hits the button the third time,the new row
is added at the last but one row and the table looks like :

(empty)|(some value)
AND|(some value)
AND|(some value)
(empty)|(empty)

When the user hits the button the fourth time,the new row
is added at the last but one row and the table looks like :

(empty)|(some value)
AND|(some value)
AND|(some value)
AND|(some value)
(empty)|(empty)

Addtional rows can be added thus expanding the table.

Thanks in advance for any help.

Sample code is as below that needs changes as per the requirement:


[ September 21, 2006: Message edited by: seema prakash ]
[ September 21, 2006: Message edited by: seema prakash ]
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
needs changes as per the requirement
Could you please state the requirement.
 
seema prakash
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks for the concern. The requirement is as stated below:

The table in its empty state, that is when it is contructed and before
the user has a chance to make any changes, a row with no data and 2 columns should be created.

The table looks like:

(empty)|(empty)

When the user hits the button once, the new row is added at position
0 in the table and the row that was created first without the user
hitting the button moves down.
Now the table looks like :

(empty)|(some value)
(empty)|(empty)

When the user hits the button the second time, the new row
is added at the last but one row and the table looks like :

(empty)|(some value)
AND|(some value)
(empty)|(empty)

When the user hits the button the third time,the new row
is added at the last but one row and the table looks like :

(empty)|(some value)
AND|(some value)
AND|(some value)
(empty)|(empty)

When the user hits the button the fourth time,the new row
is added at the last but one row and the table looks like :

(empty)|(some value)
AND|(some value)
AND|(some value)
AND|(some value)
(empty)|(empty)

Addtional rows can be added thus expanding the table.

Thanks.
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I was confused. When I run your app it seems to behave just like your requirement: the blank row remains at the bottom of the JTable and each newly–added row appears just above it. After pressing the button three times your JTable looks like this:

The fourth press hides the blank/last row and brings up the vertical scrollbar.
 
seema prakash
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. It displays the same way as you have said. But, I want it to be displayed as below with cell(0,0) = empty
cell(1...,0) = AND



[ September 22, 2006: Message edited by: seema prakash ]

[ September 22, 2006: Message edited by: seema prakash ]

[ September 22, 2006: Message edited by: seema prakash ]
[ September 22, 2006: Message edited by: seema prakash ]
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's see if this does what you want.
 
seema prakash
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot!! It works as desired.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!