Q&A

Q1:Can an application be created without Swing?
A1: Certainly. Swing is just an expansion of the Abstract Windowing Toolkit, and you can continue to use the AWT for applications with Java 2. However, event handling is different between the AWT and Swing, and there are many things in Swing that have no counter part in the windowing toolkit. With Swing, you can use many more components and control them in more sophisticated ways.
Q2:Is there a way to change the font of text that appears on a button and other components?
A2: The JComponent class includes a setFont(<II>Font</II>) method that can be used to set the font for text displayed on that component. You will work with Font objects, color, and more graphics in Day 12, "Color, Fonts, ...

Get Sams Teach Yourself Java 2 in 21 Days, Second 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.