当我设置新的 Synthetica 主题时,为什么我的 JFrame 没有重新绘制?
Why doesn't my JFrame repaint when I set a new Synthetica theme?
我刚刚将我的应用程序主题设置为 Synthetica Alu Oxide,但由于某些原因 JFrame 没有重新绘制,但另一个 Synthetica 主题将重新绘制 JFrame。
这是我的样子。
http://i.imgur.com/SOBDTs4.png
这是它应该的样子。
http://www.jyloo.com/images/screenshots/syntheticaAluOxide/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);
}
Swing GUI 对象应该仅在event dispatch thread上构建和操作,在你调用UIManager.setLookAndFeel()
.
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);
}
});
我刚刚将我的应用程序主题设置为 Synthetica Alu Oxide,但由于某些原因 JFrame 没有重新绘制,但另一个 Synthetica 主题将重新绘制 JFrame。
这是我的样子。
http://i.imgur.com/SOBDTs4.png
这是它应该的样子。
http://www.jyloo.com/images/screenshots/syntheticaAluOxide/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);
}
Swing GUI 对象应该仅在event dispatch thread上构建和操作,在你调用UIManager.setLookAndFeel()
.
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);
}
});