From: <HIDDEN>
Path: news.mathworks.com!newsfeed-00.mathworks.com!webcrossing
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to add a new property to a handle?
Message-ID: <ef537ba.7@webcrossing.raydaftYaTP>
Date: Tue, 17 Apr 2007 16:52:22 -0400
References: <ev3nli$g8b$1@canopus.cc.umanitoba.ca> <ef537ba.3@webcrossing.raydaftYaTP> <ef537ba.4@webcrossing.raydaftYaTP> <ef537ba.5@webcrossing.raydaftYaTP> <ef537ba.6@webcrossing.raydaftYaTP>
Lines: 33
NNTP-Posting-Host: 80.178.76.226
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Xref: news.mathworks.com comp.soft-sys.matlab:403824



bourrik wrote:
> You did a very good job on this one ! It's great to be able to add
java components like this.

Thanks for the compliment. I must say I'm pretty proud of the result
myself...

> Now I'd like to add a JTable to a figure, but I can't figure out
how
> to do it properly. A JTable needs some input args either to define
> data and headers, or at least to tell Java how many rows and
columns
> to display. How do you use such a syntax with uicomponent ?

JTable is indeed one of the more complex elements that you can add.
Normally, you'd want to place a JTable (or JTree etc.) within a
JScrollPane, and place THAT using UICOMPONENT, so that you'd have
default scrollbars etc. In JTable, you also need to take care of the
TableModel, sorting, cell Editors/Renderers etc. etc.

So far for the bad news. The good news is that I've already done all
that: Feel free to download my "Java-based data table" from the File
Exchange: <http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=14225>

If you look at that file's m-code, you'll see many examples of how to
pre-set Java items before the call to UICOMPONENT or JAVACOMPONENT.
My code is basically an enhanced wrapper for Matlab's
undocumented/unsupported UITABLE function.

Comments welcome.

Yair