Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #37636
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2017-11-01 08:37 -0700 |
| References | (7 earlier) <ot9qht$3bf$1@dont-email.me> <28c95541-33f4-4502-af4e-31d82c672841@googlegroups.com> <otap2d$uss$1@dont-email.me> <fd194d27-8172-4ba2-b90e-44843e950cf8@googlegroups.com> <otcm6d$q0u$1@dont-email.me> |
| Message-ID | <dc0a0a65-6ab1-455b-a2cd-c05b35176ce6@googlegroups.com> (permalink) |
| Subject | Re: How do you update the view space of a JTable? |
| From | Eric Douglas <e.d.programmer@gmail.com> |
On Wednesday, November 1, 2017 at 10:37:10 AM UTC-4, Eric Sosman wrote:
> I can't find "testFrame1" in your code, so I don't know what your
> reference to it means.
That is to say instead of doing
public final class FixedRowExample extends JFrame {
super("Fixed Row Example");
to use a separate object
public FixedRowExample() {
JFrame testFrame1 = new JFrame("Fixed Row Example");
Then to use testFrame1 for the calls to getContentPane(), addWindowListener(), pack(), and setVisible().
> It is dangerous to expose a reference to an object that is not yet
> fully built. An object is not fully built until its entire chain of
> constructors has completed. Something like `addActionListener(this)'
> publishes an object reference to code in another class, and if done
> in a constructor it is obviously done before the constructor chain
> has finished. The exposed object is incomplete, there are (at least
> potentially) threading problems with memory visibility and so on, and
> the program is in peril.
>
Isn't that what Oracle does, like where JTable constructor calls setModel() which calls dataModel.addTableModelListener(this)? (and the same for their row and column selection listeners) If that's not what you're talking about then I'm not sure what you're saying should be changed and how.
> As I said, you will "probably" be all right with this one (in this
> case), because events won't begin to fire for a while yet and there's
> "no good reason" for an event source to do anything with your object
> until they do. Daniele Futtorovic's dodge of registering listeners in
> addNotify() is an approach that hadn't occurred to me; seems clever.
>
A separate method to register external listeners always makes sense, but requiring everyone who creates an instance of your GUI object to call a separate method right after the constructor to register it's own internal listeners for basic functionality?
> You're right: Auto-boxing requires a Java 1.5 or later. If you must
> accommodate Java 1.4, you can't auto-box. (Notes: 1.5 came out thirteen
> years ago, 1.4 went off public support nine years ago, and 1.4 went off
> pay-Oracle-for-special-treatment-support four and a half years ago.)
>
I'd have to see where it came from but it's quite possible code copied from the internet is more than 10 years old.
> I have no idea what you mean by "static calls," nor why they might
> be relevant to auto-boxing.
>
int iVal = 1;
then either
String sVal = new Integer(iVal).toString();
or
String sVal = ((Integer)iVal).toString();
versus
String sVal = String.valueOf(iVal);
Most if not all the methods of these classes (Integer, Double, etc) can also be done statically.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How do you update the view space of a JTable? Eric Douglas <e.d.programmer@gmail.com> - 2017-10-17 08:47 -0700
Re: How do you update the view space of a JTable? Eric Douglas <e.d.programmer@gmail.com> - 2017-10-18 06:11 -0700
Re: How do you update the view space of a JTable? Daniele Futtorovic <da.futt.news@laposte.net> - 2017-10-30 17:41 +0100
Re: How do you update the view space of a JTable? Eric Douglas <e.d.programmer@gmail.com> - 2017-10-30 10:29 -0700
Re: How do you update the view space of a JTable? Daniele Futtorovic <da.futt.news@laposte.net> - 2017-10-31 11:10 +0100
Re: How do you update the view space of a JTable? Eric Douglas <e.d.programmer@gmail.com> - 2017-10-31 04:46 -0700
Re: How do you update the view space of a JTable? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-10-31 07:59 -0400
Re: How do you update the view space of a JTable? Eric Douglas <e.d.programmer@gmail.com> - 2017-10-31 05:21 -0700
Re: How do you update the view space of a JTable? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-10-31 08:32 -0400
Re: How do you update the view space of a JTable? Eric Douglas <e.d.programmer@gmail.com> - 2017-10-31 06:13 -0700
Re: How do you update the view space of a JTable? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-10-31 17:13 -0400
Re: How do you update the view space of a JTable? Daniele Futtorovic <da.futt.news@laposte.net> - 2017-10-31 23:33 +0100
Re: How do you update the view space of a JTable? Eric Douglas <e.d.programmer@gmail.com> - 2017-11-01 06:29 -0700
Re: How do you update the view space of a JTable? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-11-01 10:37 -0400
Re: How do you update the view space of a JTable? Eric Douglas <e.d.programmer@gmail.com> - 2017-11-01 08:37 -0700
Re: How do you update the view space of a JTable? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-11-01 13:20 -0400
csiph-web