Login  Register

Re: directory chooser problems

Posted by Jon Harman on Jan 10, 2008; 10:04pm
URL: http://imagej.273.s1.nabble.com/directory-chooser-problems-tp3697613p3697615.html

Thanks Curtis,

That works, although one needs to add code to handle an exception:
           try { UIManager.setLookAndFeel(laf);}
           catch (UnsupportedLookAndFeelException e) {}

Jon
Curtis Rueden wrote:
 > Hi Jon,
 >
 > Yeah, a change to the L&F will change over all the components (or at
 > least all components from that point forward -- the behavior for
 > existing components is kind of strange).
 >
 > You can get the current L&F by doing:
 >
 > LookAndFeel laf = UIManager.getLookAndFeel();
 >
 > Then call the directory chooser. Afterward, you can reset the L&F with:
 >
 > UIManager.setLookAndFeel(laf);
 >
 > HTH,
 > Curtis
 >
 > On Jan 9, 2008 3:09 PM, Jon Harman <[hidden email]> wrote:
 >> Hi,
 >>
 >> I'm running on a PC.
 >> I added a routine to my plugin that has a directory open dialog using
 >> the ImageJ directory chooser.  If the routine runs then the "look and
 >> feel" of my swing components changes.  I see that the directory chooser
 >> has a Java2.setSystemLookAndFeel() call.  Is this what screws up my
 >> swing components?
 >> I don't know much about getting and setting the look and feel.   How do
 >> I save the lookandfeel  before the directory chooser call so that I can
 >> restore it after the routine is finished?
 >>
 >> This does not happen with a file open call.
 >>
 >> Thanks for any help.
 >> Jon
 >>
 >