🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #8186

Re: Can a Double object passed to a JTable directly edit a double primitive in another Class?

#8186
From: John McGrath TeamB
Date: Thu, 12 Oct 2000 00:00
29 lines
1807 bytes
There are two general approaches to use when creating a TableModel.

The simpler but less general one is to use DefaultTableModel, which will 
manage the table data for you.  You load the data into it using either 
setDataVector(), or by using the addColumn() and addRow() methods.  When 
you use this approach, the data values must be objects, so you will 
typically create wrapper objects (Integer, Double, etc.) when you load 
the data.

The more general approach is to implement the TableModel interface, or 
you can extend AbstractTableModel which implements this interface.  In 
this case, you are responsible for storing and managing the table data.  
When you use this approach, you must fire table events when the data is 
changed.  AbstractTableModel provides methods for registering listeners 
and firing the events.

If you have the data in your own data structure and want the table to 
work directly on your data structure, you will probably want to use the 
TableModel / AbstractTableModel approach.  If not, then using the 
DefaultTableModel usually works pretty well.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <MPG.144f33ed913efdcd989c0b@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <39e4c595$1_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,ba69744872802910
X-Google-Attributes: gid111d45,public
From: John McGrath  [TeamB] <ng-b@JPMcGrath.net>
Subject: Re: Can a Double object passed to a JTable directly edit a double primitive in another Class?
Date: 2000/10/12
Message-ID: <MPG.144f33ed913efdcd989c0b@forums.borland.com>
X-Deja-AN: 680475576
References: <39e4c595$1_1@dnews>
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.swing