You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.3 KiB
38 lines
1.3 KiB
import View.MainFrame;
|
|
|
|
import javax.swing.*;
|
|
|
|
public class Math_learning_app {
|
|
public static void main(String[] args) {
|
|
// 设置系统样式 - 使用正确的方法
|
|
try {
|
|
// 使用跨平台外观
|
|
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
|
|
|
|
// 或者使用系统默认外观(推荐)
|
|
// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
|
|
|
} catch (Exception e) {
|
|
// 如果设置失败,使用默认外观
|
|
System.err.println("无法设置外观,使用默认外观");
|
|
e.printStackTrace();
|
|
}
|
|
|
|
// 在事件分发线程中创建和显示GUI
|
|
SwingUtilities.invokeLater(new Runnable() {
|
|
@Override
|
|
public void run() {
|
|
try {
|
|
MainFrame mainFrame = new MainFrame();
|
|
mainFrame.setVisible(true);
|
|
} catch (Exception e) {
|
|
JOptionPane.showMessageDialog(null,
|
|
"程序启动失败: " + e.getMessage(),
|
|
"错误",
|
|
JOptionPane.ERROR_MESSAGE);
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
} |