🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: duplicating Properties Dialog box

#760
From: Paul Furbacher [TeamB]
Date: Thu, 16 Dec 2004 02:58
73 lines
3303 bytes
Alan Shiers wrote:

> I'm going to have to approach this one step at a time, only becouse
> constructing a JTable appears to be no small feat.

It's less daunting than you might think.  And
I get the feeling that you aren't using all
the resources available to you.  Use the force,
Luke.

> So I thought to start out by creating a small practice example that makes
> all cells in the table of type JLabel.  According to what I've read the
> DefaultTableCellRenderer extends JLabel, so it would appear I won't have to
> make my own.
> 
> I threw together the following program in an attempt to use
> DefaultTableCellRenderer and have all the cells of the table un-editable
> (that being the case with JLabel).  However, it didn't perform as I had
> hoped.  When I ran it, each cell was still editable! Perhaps you can explain
> why that is, and what I need to do to fix it?


Well, a quick look at the JavaDoc for JTable yields

   public boolean isCellEditable(int row, int col);

What about sub-classing and overriding that method
as follows in order to make column 0 non-editable?

   public boolean isCellEditable(int row, int col) {
     return ( col != 0);
   }


I'm curious.  Are you using JBuilder to its full
advantage by drilling down into classes such as
JTable, and then flipping to the "Doc" tab to
read the JavaDoc.  You really have to adopt this
habit of work.

Also, are you using Google?  A quick, simple search
on

   jtable tutorial

netted the Swing tutorial which actually discusses
this kind of stuff.

An even more specific search would be

   jtable tutorial property editor

Lo and behold the third hit

   http://www.javaworld.com/javaworld/javatips/jw-javatip102.html

I'd say that's dead on target.


-- 


Paul Furbacher (TeamB)

   Save time, search the archives:
        http://www.borland.com/newsgroups/ngsearch.html

   Is it in Joi Ellis's Faq-O-Matic?
        http://www.visi.com/~gyles19/fom-serve/cache/1.html

   Finally, please send responses to the newsgroup only.
   That means, do not send email directly to me.
   Thank you.
Technical Details
Message-ID: <41c0f9f0$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!transit.news.xs4all.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41bdfeec$1@newsgroups.borland.com> <41be143b@newsgroups.borland.com> <41bf2893@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,f02e9216364acd50
X-Google-Attributes: gid111d45,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Wed, 15 Dec 2004 21:58:59 -0500
From: "Paul Furbacher [TeamB]" <pfurbacher@mac.com>
Organization: Reverse Alchemy, Inc.
User-Agent: Mozilla Thunderbird 0.8 (Macintosh/20040913)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing
Subject: Re: duplicating Properties Dialog box
References: <41bdfeec$1@newsgroups.borland.com> <41be143b@newsgroups.borland.com> <41bf2893@newsgroups.borland.com>
In-Reply-To: <41bf2893@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 69.142.222.65
Message-ID: <41c0f9f0$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1103165936 69.142.222.65 (15 Dec 2004 18:58:56 -0800)
Lines: 73
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!transit.news.xs4all.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail