Swing Section Index | Page 4
Is there a toolkit that can specify a Swing GUI in XML?
(Frank Sauer says) See XMLTalk
XMLTalk is a gui development framework that lets you specify an entire GUI and its interaction with data in an XML file instead of java code.
It is available as a...more
Can I use Windows Look-and-Feel on a Unix (Linux/Solaris/HP-UX) platform?
There are two parts to this answer:
Yes
No
The answer depends on what you want to do with it. The license states that you cannot deliver an application using the Windows look and feel to non-wi...more
How can I create a dockable toolbar?
Swing provides support for docking toolbars using the BorderLayout layout manager. Simply add a toolbar to a container that has a BorderLayout, set the toolbar to "floatable" and you can drag it o...more
How can I set focus in a JTextField?
You need to call requestFocus() on the JTextField.
How can I show a progress bar while reading a file?
Here's a simple example of monitoring file read progress
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileInputStream;
impo...more
How do I create checkboxes in JTables?
Assuming that you have a model for your JTable then
what you need to do is implement
public Class getColumnClass (int column)
as follows
public Class getColumnClass (int column)
{
if ( c...more
How to eliminate the "Java Applet Window" Text from JDialog?
By default, the applet security manager adds this message to any windows so the user will know it came from an applet. If they didn't do this, a nasty programmer could create a window that looks l...more
How can I determine the preferred size of a component immediately after creating it?
Because the preferred size of a component is usually dependent on fonts and decorations used for a specific platform, you need to "realize" the component before you can ask.
To realize a componen...more
Regarding Jtree How can I expand and collapse a complete JTree (including all subtress) programmatically?
You would think this would be simple, and perhaps part of the JTree functionality, but it's not as simple as it should be. I've never required the ability to programatically collapse a tree, so t...more
Can I use a single, scrollable row of tabs on a JTabbedPane?
In Java 2, v 1.4 you can. The JTabbedPane API has been updated to include setTabLayoutPolicy() to allow you to specify that you want scrollable tabs. See http://java.sun.com/products/jfc/tsc/artic...more
Does Swing provide a Spinner component?
In Java 2, v 1.4, a new JSpinner component has been provided. See http://java.sun.com/j2se/1.4/docs/guide/swing/1.4/spinner.html for details.more
How can I determine the currently-focused component?
Prior to Java 2, v1.4, unless you happened to be listening to the component for it's focusGained, you couldn't.
In Java 2, v1.4, you can ask for it using the updated focus architecture. You can f...more
How can I underline the second "A" in "Save As" as a mnemonic?
In Java 2, v1.4, AbstractButton (the superclass for buttons and menu items) and JLabel now support the notion of a "displayed mnemonic index". You can set this to specify the actual character to b...more
How can I use JProgressBar if I don't know how long a process will take?
In Java 2, v1.4, you can now define indeterminate progress bars. See http://java.sun.com/products/jfc/tsc/articles/merlin/specs/pb.html for details.more
How do I get a "open dropdown" event on a JComBoBox?
This event only exists in JDK 1.4 (currently in Beta2), look at the "What's New" section of the release doc. You can see this at http://java.sun.com/j2se/1.4/docs/guide/swing/SwingChanges.html.
more