关于JAVA 的LookAndFeel和UIManager
用java做一个界面,主体界面点击一个按钮弹出另一个小窗口,我想把主体窗口设置成系统windows风格,小窗口设置成jtattoo的mcwin风格,但是每次点击弹出小窗口都会影响到主体界面,主体界面整体风格不会变,但是菜单的图标会多出来一个,ToolTipText也会变成mcwin风格
试了两种方法都不管用
主体界面召唤小窗口时改变界面风格
public void openData(int which,int select){
if(FloodNum != null && FloodNum.length != 0){
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel("com.jtattoo.plaf.mcwin.McWinLookAndFeel");// 更换界面风格
data frame = new data(FloodNum[select],FloodBegin[select],RainEnd[select],which,Basincode[BasinNum],StationName,Stationcode,StationWeights,year[select],start_noYear);
SwingUtilities.updateComponentTreeUI(frame);// 更新UI界面
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}else{
JOptionPane.showMessageDialog(null, "你还没有连接数据库或数据库信息不全","提示", JOptionPane.WARNING_MESSAGE);
}
}
在 小窗口界面改变界面风格
try {
// String lookAndFeel = UIManager.getSystemLookAndFeelClassName();
// UIManager.setLookAndFeel(lookAndFeel);
UIManager.setLookAndFeel("com.jtattoo.plaf.mcwin.McWinLookAndFeel");// 更换界面风格
SwingUtilities.updateComponentTreeUI(this.tabbedPane);// 更新UI界面
} catch (Exception e) {
e.printStackTrace();
}
两种方法都会对主体界面产生影响,我也不想主体界面用mcwin,因为菜单会有jtattoo的水印,求问各位有没有解决办法