Swing Section Index | Page 2
What screen readers are available for Swing-based programs?
While the Java Access Bridge (http://java.sun.com/products/accessbridge/) exposes the Swing components to the platform, it seems not all screen readers understand this bridge. You can't just use a...more
Does Java work with Windows Vista?
Chet Haase at Sun claims "Java on Vista: Yes, it Works" at http://weblogs.java.net/blog/chet/archive/2006/10/java_on_vista_y.html. There is more said there than can be written here.more
How can I print the contents of a JTable as a report? - J2SE 5
How can I print the contents of a JTable as a report with title, date/time etc. as a formatted report on a paper?
Are there any predefined file filters for a JFileChooser?
Apart from the accept all filter, until Java 6, there were no predefined filters. Java 6 introduces the FileNameExtensionFilter, allowing you to define one or more types of files for the user to s...more
How can I write over a splash screen?
With Java 6, prior to the main window of the application showing, you can get the splash screen via SplashScreen splash = SplashScreen.getSplashScreen();, get its graphics context, and draw to it ...more
How do I show a splash screen for my jarred up program?
You need to specify the splash image in the manifest file for the jar:
Manifest-Version: 1.0
Main-Class: HelloSplash
SplashScreen-Image: MyImage.png
Then run the JAR without specifying t...more
How do I show a splash screen from the command-line for my program?
With JDK 6.0, there is a -splash option for java, as in java -splash:Hello.png HelloWorld.
What serves as the base class for all Swing components?
The JComponent class of the javax.swing package serves as the base class.
How can I use a component as a tab text/icon on a JTabbedPane?
Prior to Java 6, you couldn't. With Java 6, there is a new setTabComponentAt() method of JTabbedPane.
How do I print the contents of a JTextComponent, with headers, footers, and across multiple pages?
Added to JDK 6, you call the print() method of JTextComponent to do this. Prior versions required you to paginate things yourself.
Should I use the invokeLater() and invokeAndWait() method of EventQueue or SwingUtilities?
Short answer: EventQueue.
Longer answer... Utility methods were added to the SwingUtilities class because the first version of the Swing classes had to work with JDK 1.1, even though Swing was re...more
Can I use Swing with J2ME?
JSR 209 is working its way through the JCP and will add this feature.
How do I test my program for how accessible it is?
Sun provides the Java Access Bridge for Microsoft Windows users, with programs like Monkey and Ferret to see how well you've designed your graphical programs to take advantage of assistive technol...more
How do I print a JTable?
JDK 5.0 provides built in support for printing tables. Just call the print() method of JTable. Here's an example of such.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
impor...more
How do I customize the title bar for a window, frame, or dialog?
Starting with the 1.4 release, you can provide your own window adornments or decorations.
import java.awt.*;
import javax.swing.*;
public class AdornSample {
public static void m...more