🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: how to create a read-only JTable?

#9055
From: Trejkaz Xaoza
Date: Thu, 08 Jun 2000 00:00
20 lines
1137 bytes
Greg Hamer wrote:
>> The way that I do it is extend JTable and override editCellAt:

M Le wrote:
> That works.  Thank you very much for sharing your solutions!

Changing the underlying data model is the more sane way to do it, still.
If the data *really* isn't supposed to be edited, you shouldn't have the
table model say it is.

The code is simpler too. :-)
class MyTableModel extends AbstractTableModel {
   ...
    public boolean isCellEditable(int rowIndex, columnIndex) {
        return false;
    }
   ...
}

TX
Technical Details
Message-ID: <393F214C.5C951773@darker.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <393ed7a6@dnews> <8hmlrg$cqb5@bornews.borland.com> <393ee36b@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,6cc3b685d29e3672
X-Google-Attributes: gid111d45,public
From: Trejkaz Xaoza <trejkaz@darker.net>
Subject: Re: how to create a read-only JTable?
Date: 2000/06/08
Message-ID: <393F214C.5C951773@darker.net>
X-Deja-AN: 632460565
Content-Transfer-Encoding: 7bit
References: <393ed7a6@dnews> <8hmlrg$cqb5@bornews.borland.com> <393ee36b@dnews>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing