Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #14966
| From | Eric Sosman <esosman@ieee-dot-org.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: unchecked conversion warning. |
| Date | 2012-05-31 16:50 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <jq8lij$g95$1@dont-email.me> (permalink) |
| References | <3s7cs7hd18l0ffci55ns0286n4lc4cutlu@4ax.com> <f9064504-3948-43d4-b66e-55434a7a1ed1@googlegroups.com> <24hfs7hqsr75jmqgk87jcpfg85kif7nhuo@4ax.com> |
On 5/31/2012 4:23 PM, Jens wrote:
> On Wed, 30 May 2012 07:54:33 -0700 (PDT), Robert Klemme<shortcutter@googlemail.com>
> wrote:
>
>> On Wednesday, May 30, 2012 3:32:43 PM UTC+2, (unknown) wrote:
>>
>>> import java.util.Vector;
>>
>> Another remark: it is usually recommended to not use Vector any more, because the synchronization overhead is unnecessary most of the time - unless some API forces you to. The proper replacement is ArrayList. If synchronization is needed then usually Collections.synchronizedList() will do.
>>
>> Kind regards
>>
>> robert
>
> I used DefaultTableModel and Vector because it was the simplest and easiest way to get the
> project up and running. And the Oracles tutorial is, even today (2012), still using this
> approach without any remarks.
DefaultTableModel requires Vector; that's that. An alternative
would be to write your own TableModel, most likely by extending
AbstractTableModel (which already has default implementations for
most of what you'll need).
It would be silly to roll your own TableModel merely to avoid
using Vector. But if you already have your data in another form,
extending AbstractTableModel is pretty easy. If the data doesn't
all live in memory at once -- maybe it's backed by a data base, or
being supplied by a remote server, or arriving in real time --
then Vector can't hold it and DefaultTableModel is a non-starter.
> By the yway, Vector has been 'retrofitted'. From the docs:
> "As of the Java 2 platform v1.2, this class was retrofitted to implement the List
> interface, making it a member of the Java Collections Framework".
There's nothing fundamentally wrong with Vector. People will
moan and wring their hands over the cost of its synchronized methods,
but I haven't heard of any actual measurements.
> I would like to ty out what you suggest, but I have not been able to find an example where
> JTable is used.
The Java Tutorial has some. Unfortunately, JTable is a bit on
the "overdecorated" or even "baroque" side, and some things about it
don't seem to be written down anywhere at all. This leaves you with
"Read the JTable source" or "Start with a JTable not too far from
what you want, and tweak until it's closer." Both approaches are
vulnerable to "It works, but does it rely on things that are
guaranteed to keep working, or only on peculiarities of the current
version?"
(JavaDoc is both a blessing and a curse: It's a blessing in that
developers *are* encouraged to write documentation, and it's a curse
in that *developers* are encouraged to write documentation. ;)
--
Eric Sosman
esosman@ieee-dot-org.invalid
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
unchecked conversion warning. Jens - 2012-05-30 15:32 +0200
Re: unchecked conversion warning. Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-05-30 13:48 +0000
Re: unchecked conversion warning. Jens - 2012-05-30 15:52 +0200
Re: unchecked conversion warning. Robert Klemme <shortcutter@googlemail.com> - 2012-05-30 07:54 -0700
Re: unchecked conversion warning. Jens - 2012-05-31 22:23 +0200
Re: unchecked conversion warning. Lew <lewbloch@gmail.com> - 2012-05-31 13:40 -0700
Re: unchecked conversion warning. Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-05-31 16:50 -0400
Re: unchecked conversion warning. Lew <lewbloch@gmail.com> - 2012-05-31 17:18 -0700
Re: unchecked conversion warning. Robert Klemme <shortcutter@googlemail.com> - 2012-06-01 08:14 +0200
Re: unchecked conversion warning. Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-01 08:48 -0400
Re: unchecked conversion warning. Robert Klemme <shortcutter@googlemail.com> - 2012-06-01 07:32 -0700
Re: unchecked conversion warning. Roedy Green <see_website@mindprod.com.invalid> - 2012-06-10 12:16 -0700
Re: unchecked conversion warning. Martin Gregorie <martin@address-in-sig.invalid> - 2012-06-10 22:08 +0000
Re: unchecked conversion warning. Lew <noone@lewscanon.com> - 2012-06-10 17:09 -0700
Re: unchecked conversion warning. Martin Gregorie <martin@address-in-sig.invalid> - 2012-06-11 01:31 +0000
Re: unchecked conversion warning. Jim Janney <jjanney@shell.xmission.com> - 2012-06-01 08:41 -0600
Re: unchecked conversion warning. Patricia Shanahan <pats@acm.org> - 2012-06-01 08:44 -0700
Re: unchecked conversion warning. markspace <-@.> - 2012-06-01 09:08 -0700
Re: unchecked conversion warning. Gene Wirchenko <genew@ocis.net> - 2012-06-01 09:31 -0700
Re: unchecked conversion warning. Jim Janney <jjanney@shell.xmission.com> - 2012-06-01 11:02 -0600
Re: unchecked conversion warning. Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-01 13:54 -0400
Re: unchecked conversion warning. Patricia Shanahan <pats@acm.org> - 2012-06-01 16:44 -0700
Re: unchecked conversion warning. Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-01 20:24 -0400
Re: unchecked conversion warning. Patricia Shanahan <pats@acm.org> - 2012-06-01 19:36 -0700
Re: natural/native language capabilities (was: unchecked conversion warning.) Jim Janney <jjanney@shell.xmission.com> - 2012-06-01 11:01 -0600
Re: unchecked conversion warning. Roedy Green <see_website@mindprod.com.invalid> - 2012-06-10 12:13 -0700
Re: unchecked conversion warning. Arne Vajhøj <arne@vajhoej.dk> - 2012-06-20 19:28 -0400
Re: unchecked conversion warning. Broad Liyn <broadliyn@gmail.com> - 2012-06-10 21:52 -0700
Re: unchecked conversion warning. Lew <noone@lewscanon.com> - 2012-06-10 23:50 -0700
Re: unchecked conversion warning. Patricia Shanahan <pats@acm.org> - 2012-06-11 00:06 -0700
Re: unchecked conversion warning. Robert Klemme <shortcutter@googlemail.com> - 2012-06-16 15:17 +0200
Re: unchecked conversion warning. Lew <lewbloch@gmail.com> - 2012-06-18 12:28 -0700
Re: unchecked conversion warning. Robert Klemme <shortcutter@googlemail.com> - 2012-06-19 23:14 +0200
Re: unchecked conversion warning. Lew <lewbloch@gmail.com> - 2012-06-19 17:15 -0700
Re: unchecked conversion warning. Arne Vajhøj <arne@vajhoej.dk> - 2012-06-20 19:22 -0400
Re: unchecked conversion warning. Arne Vajhøj <arne@vajhoej.dk> - 2012-06-20 19:20 -0400
csiph-web