|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ptolemy.gui.JFileChooserBugFix
public class JFileChooserBugFix
A workaround for a JFileChooser bug.
This class is necessary to work around a bug under Windows where the "common places" portion of the JFileChooser dialog is affected by the background color of a component. Sun has acknowledged the bug as #6817933. See also "open dialog, common places pane has white box instead of text."
Every time JFileChooser is instantiated, saveBackground() should be called so that the background is properly set. Then, in a finally clause, restoreBackground() should be called. For example:
// Swap backgrounds and avoid white boxes in "common places" dialog JFileChooserBugFix jFileChooserBugFix = new JFileChooserBugFix(); Color background = null; try { background = jFileChooserBugFix.saveBackground(); JFileChooser fileDialog = new JFileChooser(); // Do the usual JFileChooser song and dance . . . } finally { jFileChooserBugFix.restoreBackground(background); }
Red (cxh) |
Red (cxh) |
Field Summary | |
---|---|
private javax.swing.text.html.HTMLEditorKit |
_HTMLEditorKit
The HTMLEditorKit |
Constructor Summary | |
---|---|
JFileChooserBugFix()
Instantiate a JFileChooserBugFix object. |
Method Summary | |
---|---|
void |
restoreBackground(java.awt.Color background)
Restore the background. |
java.awt.Color |
saveBackground()
Set the background to the value of the ToolBar.shadow property and return the previous background. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private javax.swing.text.html.HTMLEditorKit _HTMLEditorKit
Constructor Detail |
---|
public JFileChooserBugFix()
Method Detail |
---|
public void restoreBackground(java.awt.Color background)
background
- The background to be restored.saveBackground()
public java.awt.Color saveBackground()
Avoid a problem under Windows where the common places pane on the left of the file browser dialog has white boxes because the background is set to white. http://bugzilla.ecoinformatics.org/show_bug.cgi?id=3801
Call this method before instantiating a JFileChooser.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |