A browser with JavaScript enabled is required for this page to operate properly.
Trail: Creating a GUI With JFC/Swing
Lesson: Using Other Swing Features
Solving Common Problems Using Other Swing Features
Home Page > Creating a GUI With JFC/Swing > Using Other Swing Features

Solving Common Problems Using Other Swing Features

Problem: My application is not showing the look and feel I have requested via UIManager.setLookAndFeel.

You probably either set the look and feel to an invalid look and feel or set it after the UI manager loaded the default look and feel. If you are sure that the look and feel you specified is valid and setting the look and feel is the first thing your program does (at the top of its main method, for example), check whether you have a static field that references a Swing class. This reference can cause the default look and feel to be loaded if none has been specified. For more information, including how to set a look and feel after the GUI has been created, see the look and feel section.

Problem: Why is not my component getting the focus?

Problem: Why cannot my dialog receive the event generated when the user hits the Escape key? This worked until I ported to release 1.4.

If your dialog contains a text field, it may be consuming the event. (Prior to release 1.4.0, the text field did not get the focus.)

Problem: Why I cannot apply Swing components to a tray icon? Current implementation of the TrayIcon class supports the PopupMenu component, but not its Swing counterpart JPopupMenu. This limitation narrows capabilities to employ additional Swing features, for example, menu icons. See the Bug ID 6285881.

If you do not find your problem in this section, consult Solving Common Component Problems.


Problems with the examples? Try Compiling and Running the Examples: FAQs.
Complaints? Compliments? Suggestions? Give us your feedback.

Previous page: How to Use the System Tray
Next page: Laying Out Components Within a Container