Re: L&F gotcha
Roedy Green wrote:
I figured out you must reset the decoration, after you change the L&F,
while the Frame is not realised, like this:
This didn't really work for me. It redrew the frame all right, but I
always got the Windows (my OS) style frame, never the requested L&F.
More work needed I think.
Here's the snippet of Code I changed from John's link. It was pretty
much a blind change, I didn't read through all of Rob Camick's code:
public void actionPerformed( ActionEvent e )
{
try
{
UIManager.setLookAndFeel( laf );
defaults.resetComponents();
JMenuItem mi = (JMenuItem) e.getSource();
JPopupMenu popup = (JPopupMenu) mi.getParent();
JRootPane rootPane = SwingUtilities.getRootPane( popup.
getInvoker() );
SwingUtilities.updateComponentTreeUI( rootPane );
JFrame jFrame = frame;
System.err.println( "Hacking..." );
jFrame.setVisible( false );
jFrame.dispose();
jFrame.setUndecorated( false );
jFrame.getRootPane().setWindowDecorationStyle(
JRootPane.NONE );
jFrame.setVisible( true );
} catch( Exception ex )
{
System.out.println( "Failed loading L&F: " + laf );
System.out.println( ex );
}
}
}