• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable-in-Swing  RSS feed

 
Comal Rajagopalaratnam Muthukumar
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
My Table though is coded as per textbook but does not fetch the real values Can any one correct me to get the actual
values as per key board entry
Thanks
As
CRMK
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good grief!

Did your textbook really have those dreadfully long lines (I corrected the worst offenders) or inconsistent indentation or confusing variable names or multiple declarations? As well as that, please always tell us where such code comes from, to avoid copyright problems.
Also please tell some details. For example what was the input and what was the output and what had you expected?
 
Comal Rajagopalaratnam Muthukumar
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Good grief!

Did your textbook really have those dreadfully long lines (I corrected the worst offenders) or inconsistent indentation or confusing variable names or multiple declarations? As well as that, please always tell us where such code comes from, to avoid copyright problems.
Also please tell some details. For example what was the input and what was the output and what had you expected?

Hi
My appologies My Thanks aswell
My simple clarification is to

"How to use JTable in swing for enabling me to write the data at the key board to have them in the table"
Please tell more about this since my prg above works fine but for vallues only since the out put t as you can see looks
like this:-

Of course this gives me tabled out put
with the zeros and not the data i wrote as under
*******

0 00 0 0 0 0 0
0 0
0
etc etc
*********

 
Rob Camick
Ranch Hand
Posts: 2787
12
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


When you create the Array, the value of all those variables are 0. The Array does not get automatically update when you assign a new value to each field.

Your code should be something like:



Now the Array will be created AFTER you entered all the values from the keyboard.
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You haven't told us which textbook it was. I presume it is very old if it uses the show() method.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:You haven't told us which textbook it was. I presume it is very old if it uses the show() method.


Another sign of its age is the use of a WindowAdapter instead of EXIT_ON_CLOSE, introduced in Java 1.3.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!