Forgot your
password?
HOME
FAQS
FORUMS
DOWNLOADS
ARTICLES
PEERSCOPE
LEARN
Search
View:
What's New
Index by Topic
Contributors
Topic List
Printable View
Unanswered Questions
Suggested Path
Swing FAQ Home Page
FAQ Manager is guru
Sandip Chitale
PREMIUM
.
As part of the Java Foundation Classes (JFC), the Swing component set builds on the AWT to provide a pure Java-based graphical user interface (GUI) for your programs.
What's New
How do I specify the popup menu to show for an application on the system tray?
Java:API:Swing:Widgets
John Zukowski
PREMIUM
, Jan 2, 2008
When you create the TrayIcon for the SystemTray, you specify the PopupMenu. TrayIcon trayIcon = new TrayIcon(anImage, "Tooltip", aPopupMenu); Just...
If I want to manually size my icon for the system tray, how do I find out the correct size for the platform?
Java:API:Swing:Widgets
John Zukowski
PREMIUM
, Jan 2, 2008
The getTrayIconSize() method of SystemTray will return the appropriate Dimension for the icon. This allows you to either pick the most appropriate size...
How do you find out if the user's platform supports adding applications to the system tray?
Java:API:Swing:Widgets
John Zukowski
PREMIUM
, Jan 2, 2008
Ask the SystemTray class with its static isSupported() method. The javadoc for the class includes a warning when true is returned. Just because the system...
How do I specify an icon to include with a message over a system tray application icon?
Java:API:Swing:Widgets
John Zukowski
PREMIUM
, Jan 2, 2008
The TrayIcon.MessageType enumeration allows you to specify an ERROR, INFO, or WARNING icon, in addition to NONE when displaying a message with displayMessage()....
How do I show a popup message over a system tray icon/application?
Java:API:Swing:Widgets
John Zukowski
PREMIUM
, Jan 2, 2008
The displayMessage() method of TrayIcon allows you to show a timed message, if supported on the platform.
How do I place a tooltip over a system tray icon?
Java:API:Swing:Widgets
John Zukowski
PREMIUM
, Jan 2, 2008
The TrayIcon class offers a setToolTip() method to provide a string for the message.
How do I know what size icon to use for an application on the system tray?
Java:API:Swing:Widgets
John Zukowski
PREMIUM
, Jan 2, 2008
If you don't want to size the icon yourself, you can call setImageAutoSize() with a value of true for the TrayIcon. By default, the property is false....
How do I clear the selection in a ButtonGroup such that no elements of the associated set of abstract buttons are selected?
Java:API:Swing:Widgets
John Zukowski
PREMIUM
, Jul 8, 2007
Early versions required a hack with a hidden button. In Java 6, you can use the new clearSelection() method.
When dropping an object over a JTree, how do you determine the node being dropped over?
Java:API:AWT:Drag and Drop
,
Java:API:Swing:Widgets
John Zukowski
PREMIUM
, May 31, 2007
The importData() method of your TransferHandler has a TransferSupport argument. From this support object, you can ask for the drop location with getDr...
When having a droppable JTree, how do I change the default behavior of using selection to see the active drop target?
Java:API:AWT:Drag and Drop
,
Java:API:Swing:Widgets
John Zukowski
PREMIUM
, May 31, 2007
JTree has a setDropMode() method to change the default setting of USE_SELECTION. Other valid modes are ON, INSERT, and ON_OR_INSERT. ON lets you drop something...
When creating a Yes/No JOptionPane, how do I default the value to No instead of Yes?
Java:API:Swing:Widgets
John Zukowski
PREMIUM
, Mar 9, 2007
You need to explicitly pass in the button labels and initial value via the showOptionDialog() method (or constructor). int selection = JOptionPane....
What accessible roles were added to the 1.4 J2SE accessibility API?
Java:API:AWT:Accessibility
,
Java:API:Swing:Accessibility
John Zukowski
PREMIUM
, Dec 31, 2006
Class AccessibleRole Added the following constants: DATE_EDITOR FONT_CHOOSER GROUP_BOX SPIN_BOX STATUS_BAR
How can I find out if my application is being used with a screen magnifier?
Java:API:AWT:Accessibility
,
Java:API:Swing:Accessibility
John Zukowski
PREMIUM
, Dec 31, 2006
The javax.accessibility.screen_magnifier_present property is available. When true, the magnifier is present, and your application can be altered accor...
Which accessible interfaces were added for J2SE 1.4?
Java:API:AWT:Accessibility
,
Java:API:Swing:Accessibility
John Zukowski
PREMIUM
, Dec 31, 2006
The 1.4 API increased the accessibility API by adding the following: javax.accessibility.AccessibleEditableText javax.accessibility.AccessibleExt...
What is the purpose of AccessibleExtendedComponent?
Java:API:AWT
,
Java:API:Swing
John Zukowski
PREMIUM
, Dec 4, 2006
The original accessible API set missed some features in the AccessibleComponent interface. Since the main interface couldn't be altered, Sun introduced...
What screen readers are available for Swing-based programs?
Java:API:Swing:Widgets
John Zukowski
PREMIUM
, Nov 27, 2006
While the Java Access Bridge (http://java.sun.com/products/accessbridge/) exposes the Swing components to the platform, it seems not all screen readers...
Does Java work with Windows Vista?
Java:API:Swing
,
Java:Language
John Zukowski
PREMIUM
, Oct 31, 2006
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...
How can I print the contents of a JTable as a report with title, date/time etc. as a formatted report on a paper?
Java:API:Swing
John Zukowski
PREMIUM
, Oct 31, 2006
This was previously answered for earlier versions of the JDK at http://www.jguru.com/faq/view.jsp?EID=46732. Now, with J2SE 5, you can just call the print()...
Are there any predefined file filters for a JFileChooser?
Java:API:Swing:Widgets
,
Java:API:IO:Filters
John Zukowski
PREMIUM
, Jun 30, 2006
Apart from the accept all filter, until Java 6, there were no predefined filters. Java 6 introduces the FileNameExtensionFilter, allowing you to define...
How can I write over a splash screen?
Java:API:Swing
John Zukowski
PREMIUM
, Mar 31, 2006
With Java 6, prior to the main window of the application showing, you can get the splash screen via SplashScreen splash = SplashScreen.getSplashScreen();,...
« previous
beginning
next »
Related Links
Swing Forum
Sun's Swing Home Page
The Swing Connection
Swing in the Java Tutorial
Swing Short Course, part I
Swing Short Course, part II
Wish List
Features
About jGuru
Contact Us