阿里云IOT 用MQTT.fx 连接 生成用户密码 swing桌面工具

 

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;
                }
                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值