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 ReviewWe'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 ...
Get Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.