package cloud.tianai.captcha.demo; import com.formdev.flatlaf.FlatDarkLaf; import com.formdev.flatlaf.FlatLightLaf; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.stereotype.Controller; import javax.swing.*; import java.awt.*; @Slf4j @Controller @SpringBootApplication public class TianaiCaptchaDemoApplication { public static void main(String[] args) throws UnsupportedLookAndFeelException { // 初始化皮肤 FlatLightLaf.install(); UIManager.setLookAndFeel( new FlatDarkLaf()); // 初始化窗口 JFrame jFrame = new JFrame("验证码服务"); // 设置大小 jFrame.setSize(500, 500); // 关闭窗口后退出 jFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // 设置居中 jFrame.setLocationRelativeTo(null); // 设置图标 // 示例:正确加载资源 ImageIcon icon = new ImageIcon(TianaiCaptchaDemoApplication.class.getResource("/images/icon.png")); jFrame.setIconImage(icon.getImage()); // 设置元素 JPanel jPanel = new JPanel(new BorderLayout()); jPanel.add(new JLabel("服务已启动", JLabel.CENTER), BorderLayout.CENTER); jFrame.getContentPane().add(jPanel); // 显示窗口 jFrame.setVisible(true); extracted(args); } private static void extracted(String[] args) { SpringApplication.run(TianaiCaptchaDemoApplication.class, args); } }