Swing Section Index | Page 6
How can I add a TableCellRenderer to a JTable that catches mouse events?
Renderers are simply "rubber stamps" that are used to paint a cell in a table. They are not live components.
You can deal with the mouse events in two ways:
Add a mouse listener to the table it...more
How can I determine all of the components contained in a JFrame?
To get a list of all components in a JFrame, you could need to write a recursive method like the following:
public void getAllComponents(Component c, Collection collection) {
collection.add(c)...more
How can I determine if the user has switched cells in a JTable?
You can listen for
Changes in selection in the table. When the user switches cells, the selection changes (you would need to be sure your cell editor actually does change selection if you're usi...more
How can I force JTree to display changing nodes added at runtime?
You need to make sure you fire the appropriate events from your tree model after updating the tree.
The JTree will wait for update notification before changing its display. This allows you to add...more
How can I resize an ImageIcon?
ImageIcon is not a java.awt.Component
subclass thus you cannot resize it directly. You have to use the following
variant of java.awt.Graphics.drawImage -
public abstract boolean drawImage(Image i...more
How can I update a GUI component immediately during a long-running operation?
AWT/Swing does its repaints only on what are called AWT threads. Therefore you should do the long running processing
on background thread (not the thread on which you are handling callbacks from A...more
How do we stop the AWT Thread? Our Swing application will not terminate.
You need to explicitly call System.exit(exit_value) to exit a Swing application. This is because the event dispatcher thread is not a Daemon thread, and won't allow the JVM to shut down when othe...more
Where can I find the BeanInfo classes for the Swing components
These are found in the dt.jar file that comes with the JDK. They are NOT in your CLASSPATH by default.
How can I implement a horizontal Org chart in an applet, preferably with the same functionality as JTree?
[FAQ Manager Note] While the following won't give you JTree compatability out of the box, you have two choices:
Create a wrapper component for a JHotDraw drawing that has a similar interface as J...more
How can I set the font of the title bar of a JFrame in a Java application?
Without special support, you cannot.
You may want to look at
http://www.windsong.demon.co.uk/javadocs/com.ravnaandtines.util.swing.JExternalFrame.html
which gives you pretty much full control. Yo...more
How can I highlight some text in an inactive textfield?
Here is a sample for you.
import javax.swing.*;
import java.awt.*;
import javax.swing.text.*;
public class TpHighlight extends JFrame {
String tf_str="Hello this is a demo for High Lighting...more
SSN Validation Are there any guides to validating social security numbers?
The first three digits of an SSN map to the location where the number was requested. The Social Security Administration maintains a list of valid digit mappings at http://www.ssa.gov/foia/stateweb...more
How can I provide word completion functionality in a JComboBox? (When the user enters characters then the closest matching item should be selected)
How can I provide word completion functionality in a JComboBox?
(When the user enters characters then the closest matching item should be selected)
Where can I learn (more) about dealing with 2D (two dimensional) and 3D (three dimensional) images, sound, speech, telelphony, and the rest of Java's support for advanced media handling?
Where can I learn (more) about dealing with 2D (two dimensional) and 3D
(three dimensional) images, sound, speech, telelphony, and the rest of
Java's support for advanced media handling?
Where can I learn (more) about Java's suport for internationalization (I18N)?
Check out the jGuru I18N FAQ.