Blank
Blank

Reputation: 363

How to print a Java Swing UI which contains lots of component?

Requirement Description:

(1) I designed a UI with Java Swing Components which contains JTextFiled, JLabel, and JTable.

(2) The JTable was wrapped in a JScrollPanel due to UI size limitation.

Problem:

I wanna print the all the components with a "PRINT" button. But I am stuck by the JTable with the case that there are some rows in the talbe cannot be visible(which cannot be printed).

So what should I do about the JTable, or there is another way to print the whole components?

Thanks advanced, really appreciate your help!

Upvotes: 1

Views: 968

Answers (1)

Gilbert Le Blanc
Gilbert Le Blanc

Reputation: 51445

You don't want to print the UI. You want to print the contents of the JTable.

The JTable has an API for printing. This tutorial might help: How to Print Tables

Upvotes: 3

Related Questions