当我设置一个新的Synthetica主题时,为什么我的JFrame没有重新绘制?

我只是将我的应用程序主题设置为Synthetica Alu Oxide,但是有些原因JFrame没有重新绘制,但另一个Synthetica主题将重新绘制JFrame。

这就是我的样子。

http://sofzh.miximages.com/java/removed.png

这就是它的假设。

http://sofzh.miximages.com/java/democenter2.png

public MainPanel() { JFrame frame = new JFrame(); frame.setTitle("Asteria 3.0 NPC Definition Editor"); try { UIManager.setLookAndFeel(new SyntheticaAluOxideLookAndFeel()); } catch (UnsupportedLookAndFeelException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } components(); frame.setJMenuBar(menuBar); JTabbedPane tab = new JTabbedPane(); tab.addTab("Information", informationTab()); tab.addTab("Bonuses", bonusTab()); tab.addTab("Animation", animTab()); tab.addTab("Property", propertiesTab()); tab.addTab("Miscellaneous", miscTab()); frame.getContentPane().add(tab); //frame.add(this); frame.setSize(500, 600); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } 

在调用UIManager.setLookAndFeel() 之后 ,应在事件派发线程上构造和操作Swing GUI对象。

 try { UIManager.setLookAndFeel(new SyntheticaAluOxideLookAndFeel()); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } EventQueue.invokeLater(new Runnable() { public void run() { JFrame frame = new JFrame(); … frame.pack(true); frame.setVisible(true); } });