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(); } } }); } }