package license.aliyuniot;
import com.formdev.flatlaf.FlatDarculaLaf;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;
import java.util.Formatter;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.swing.*;
import javax.swing.border.*;
/**
* @author 1
*/
public class AliyunIot extends JFrame {
public static void main(String[] args) {
FlatDarculaLaf.install();
new AliyunIot().setVisible(true);
}
public AliyunIot() {
initComponents();
//655 540
setTitle("三元组生成连接地址"); // 标题
setResizable(false); // 固定窗体
//setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); //退出窗口不适用
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //关闭窗口 ,退出进程
//显示屏幕中央
int width = 400; //宽度
int height = 300; // 高度
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
/** 屏幕宽度 */
int screenWidth = screenSize.width;
/** 屏幕高度 */
int screenHeight = screenSize.height;
setLocation((screenWidth - width) / 2, (screenHeight - height) / 2);
setMinimumSize(new Dimension(width,height)); //窗体大小
button1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String productKey = textField1.getText();
String deviceName = textField2.getText();
String deviceSecret = textField3.getText();
if(productKey == null || "".equals(productKey)){
JOptionPane.showMessageDialog(null,"productKey 不能为空");
return;
}else if(deviceName == null || "".equals(deviceName)){
JOptionPane.showMessageDialog(null,"deviceName 不能为空");
return;
}else if(deviceSecret == null || "".equals(deviceSecret)){
JOptionPane.showMessageDialog(null,"deviceSecret 不能为空");
return;
}