Article View: borland.public.jbuilder.java.swing
Article #11355Re: JTable Columns
From: Quach Hoa Thanh
Date: Mon, 14 Jun 1999 00:00
Date: Mon, 14 Jun 1999 00:00
47 lines
2408 bytes
2408 bytes
Steve, the columns appeared when I put JTable inside JScrollPane. However It cut off the a bit the top of column title. I'm not sure why but I will mess around with it. The reason I used DefaultTableModel instead of AbstractTableModel because I want to be able to manipulate rows such as adding, deleting and so on.. According to Java API docs, DefaultTableModel is a subclass of AbstractTableModel. It should work. If I find out a way to make it work, I will post the code here. Thanh. Quach Hoa Thanh wrote: > Thanks Steve for the help. I certainly will try it inside the JScrollPane. I > will let you know of the result. > > Thanh > > Steve Horsley wrote: > > > 1: The column name code looks OK to me. I just did a JTable like this > > last week, and the column names appeared OK. However - I put the > > JTable inside a JScrollPane, and I got the impression that it was the > > JScrollPane that was displaying the column names - the names didn't > > scroll with the table data. It looked neat! Give it a try. > > > > 2: The Sun documentation suggests that is is the AbstractTableModel > > that you should be overriding anyway. If it works, be happy. > > > > Steve > > //----------------------------------------------- > > > > Quach Hoa Thanh wrote: > > > > > > I have two problems with the above code and I still don't know why. > > > > > > 1. JTable displays values in the cell from the two dimensional array. > > > But it didn't show any columns title at all even though the code tells > > > it to do so. > > > > > > 2. DefaultTableModel is a subclass of AbstractTableModel. For some > > > reasons, it blows up when I try to use it. AbstractTableModel works out > > > beautifully. > > > > > > Thanks for all your helps. > > > > > > Thanh
Technical Details
Message-ID:
<3765839E.AEB2697@ns.sympatico.ca>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3763E235.80724A4@ns.sympatico.ca> <3764C6B6.8F6FF6EE@cwcom.co.uk> <37657039.C7B77F6F@ns.sympatico.ca>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,eb4b6527d333ff79 X-Google-Attributes: gid111d45,public From: Quach Hoa Thanh <thq.qua@ns.sympatico.ca> Subject: Re: JTable Columns Date: 1999/06/14 Message-ID: <3765839E.AEB2697@ns.sympatico.ca> X-Deja-AN: 489616489 Content-Transfer-Encoding: 7bit References: <3763E235.80724A4@ns.sympatico.ca> <3764C6B6.8F6FF6EE@cwcom.co.uk> <37657039.C7B77F6F@ns.sympatico.ca> Content-Type: text/plain; charset=us-ascii Organization: Self Employed Mime-Version: 1.0 Reply-To: thq.qua@ns.sympatico.ca Newsgroups: borland.public.jbuilder.java.swing