Suppose you've written an application with a GUI using Swing components such as JTable or JTextPane.
Tutorial Details:
Suppose you've written an application with a GUI using Swing components such as JTable or JTextPane. All these components are derived from the abstract class javax.swing.JComponent, which includes the print(Graphics g) method: You can use this method to let the Swing component print itself to iText's PdfGraphics2D object.
It contains a JTable found in Sun's Java tutorial on Swing components. If you click the first button, the contents of the table are added to a PDF using createGraphicsShapes() (the upper PDF in the screenshot). If you click the second button, the table is added using createGraphics() (the lower PDF, using the standard Type 1 font Helvetica). Notice the subtle differences between the fonts used for both variants.
To make these charts, you'll combine iText with JFreeChart, an interesting library developed by David Gilbert and Thomas Morgner. The Website jfree.org explains that JFreeChart is "a free Java class library for generating charts, including pie charts (2D and 3D), bar charts (regular and stacked, with an optional 3D effect), line and area charts, scatter plots and bubble charts, time series, high/low/open/close charts and candle stick charts, combination charts, Pareto charts, Gantt charts, wind plots, meter charts and symbol charts, and wafer map charts."
Read
Tutorial at: Click here to view the tutorial
Rate Tutorial: Export Swing components to PDF
View Tutorial: Export Swing components to PDF
Related
Tutorials:
Focus on Swing -
JavaWorld - July
1998
Focus on Swing -
JavaWorld - July
1998 |
Printing in
Java, Part 3 - JavaWorld January 2001
Printing in
Java, Part 3 - JavaWorld January 2001 |
Take command of your
software
Take command of your
software |
Remote-control
Java
Remote-control
Java |
Smart Value Object goes
one step further
Smart Value Object goes one step further
The Smart Value Object allows server components to track client-side modification of business objects in a rich client/J2EE server environment, by using the latest features offered by bytecode processing tools.
|
AurigaDoclet: Javadoc doclet for generating javadoc in pdf, postscript, etc
What Is AurigaDoclet?
AurigaDoclet is a Javadoc doclet which can generate Java API document in fo, pdf, postscript, pcl, and svg format. AurigaDoclet accepts command line options which can be used to further customize the generated output. |
SpeedJG - XML Builder
SpeedJG - XML based Java Swing GUI Builder |
Data Models for Desktop Apps
Data Models for Desktop Apps
This is the third article in a series that presents the prototype of a Java desktop application called JImaging. The first article described the three major Java GUI toolkits: AWT, Swing, and SWT. In the second article, I int |
Developing Swing Components Using Simulators
Developing Swing Components Using Simulators
In this article, you'll learn about a technique for developing encapsulated components. You'll also learn about how to test graphical parts of your application that JUnit can't, such as layouts and other visua |
G (2D graphic library)
G is a generic graphics library built on top of Java 2D in order to make scene graph oriented 2D graphics available to client applications in a high level, easy to use way |
Creating Custom Desktop Components
This article presents a drawing component used by an image-annotation application named JImaging. Some of the JImaging code has already been described in two other articles, titled "Prototyping Desktop Applications" and "Data Models for Desktop Apps." |
InfoNode (Java Components)
InfoNode Docking Windows is a pure Java Swing based docking windows framework. The best way to see features of InfoNode Docking Windows is to try the Web Start demos.
|
PDFTextStream v1.1.2 Released; Fast Java PDF Text Extraction
PDFTextStream is the ideal solution for Java applications and J2EE web services that need to rapidly and accurately extract text and document metadata from PDF files. |
SQL Uniform
SQL Uniform is a general interface (GUI), a helper application to relational databases of various types regarding query, maintenance, data comparison, export (convert). |
JFindReplace
JFindReplace is a "find and replace" swing component working with various options (regulation expression, incremental mode...) and standard text components like JTextArea, JTextPane, JEditorPane.... |
JDock 1.1 - Swing docking framework
JDock is a pure java swing framework for managing, moving and resizing inner windows or components using a layout manager like a BorderLayout or a GridBagLayout.
|
What's New in Swing?
A new skinnable look and feel (Synth), printing support for |JTable| components, the ability to add components directly to a frame, these are a few of the new features in Swing for J2SE 5.0. |
Just Forms PDF library
The JustFormsPDF library is a Java class library for filling or editing interactive PDF forms on-the-fly. Empower your applications with the industry-standard PDF forms technology using JustFormsPDF. |
J2SE Platform Migration Guide (pdf)
This guide helps developers migrate Java applets, standalone applications, Java Web Start applications and development tools from version 1.3 and 1.4 of the Java platform to version 5.0. |
DB Visual Architect for Eclipse
DB Visual Architect for Eclipse (DBVA-EC) is a full featured Object Relational Mapping (ORM) plugin for Eclipse that provides the industry\'s best round-trip code engineering support with Java. |
|
|
|