• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JTable-in-Swing

 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
*********

 
Rancher
Posts: 3324
32
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic