O'Reilly logo

Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython by Richard Hightower

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with Table Models

The most common way to create tables is to supply the data model first. JTable works with any class instance that inherits from the TableModel interface (recall that a Java interface is like a Python class with all abstract methods). Let's first see what the TableModel methods do and then create a short example that uses our old address book application.

Data Model Review

We've covered TableModel and JList, so I won't go into the same level of detail because I'm assuming that you did your reading and your exercises and now have a basic understanding of them. If you don't, you may want to do a little review. You'll need it to understand the JTable and JTree controls, which will be covered later on.

The TableModel Interface ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required