Lesson 22Rendering Tabular Data in the GUI

This lesson shows you how to display tabular data on the graphical user interface (GUI). Data grids and spreadheet-like data are very popular in the enterprise applications. Most of this lesson is dedicated to working with a powerful Swing component called JTable. This user interface (UI) component enables you to present data in a grid with rows and columns. After learning the basics of working with JTable, you see how to display tabular data using the JavaFX TableView control. In the “Try It” section you apply these new skills to display the portfolio data that, as of Chapter 21, is stored in the database.

In other words, you build a client-server application, where the Java GUI is a client and the RDBMS is a server. Such architecture was pretty popular in the mid-1990s. Rich clients were developed in Visual Basic, PowerBuilder, Delphi, Java, or C++, and they connected directly to database servers such as Oracle, DB2, Sybase, Microsoft SQL Server, and Informix.

In the late ’90s, thin clients (plain-looking HTML-based web pages with almost no code implementing business logic) became the trend. These days applications with rich UIs are coming back, but typically you’ll be using an application server as a middleman between the client and the data storage. I describe such middlemen starting in Chapter 25, but your UI skills need to include the ability to program data grids.

JTable and the MVC Paradigm

The Swing class JTable is a powerful ...

Get Java Programming 24-Hour Trainer, 2nd Edition 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.