Why are the contents of this table not being shown?

R

Roedy Green

and now the app behaves better. I guess I am supposed to build the
table contents inside the 'TableTableModel'? IOW:

contents[1, 2] = "Hello";
contents[1, 3] = "World";
[...]

There has to be some of array, or ArrayList or Collection to hold the
data that the DataModel can fetch whenever the GUI decides it that row
is now onscreen. It is up to you to fetch it. How does it get into
the table? That to is completely up to you. It might be put there
with some methods of your own. You might read it from a file. You
might create it with static init. You might fetch it as needed from an
SQL database, caching part of it... How you hold the model is 100% up
to you.
 
A

Andrew Thompson

Daniel said:
....
To his defense, the original post only showed the call to
new MyApp().show(), which looks like it belongs to a JFrame object.

That was pretty much my assumption.
- The invokeLater() call is most commonly used
for root components,
- the most common root component used is a JFrame
- (it was the Swing package, so we might rule out a
java.awt.Frame).

The lines I added were literally (as far as I was trying)
'wrapped around' the given code, to show the actual
effect when compiled.

Then, since is constituted an SSCCE, I labelled it as such.
...Thats why its
always best to post a complete SSCCE, rather than only the snippet that
you think is appropriate.

Very sound advice. I try to take that principle myself. ;-)

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200711/1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,131
Latest member
IsiahLiebe
Top