软件license授权加、解密,软件注册工具(1)

/*
 * Created by JFormDesigner on Thu Aug 27 15:59:25 CST 2020
 */

package license;

import com.formdev.flatlaf.FlatDarculaLaf;
import javazoom.jl.decoder.JavaLayerException;
import javazoom.jl.player.Player;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.NetworkInterface;
import java.net.URL;
import java.net.URLConnection;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Enumeration;
import javax.swing.*;
import javax.swing.border.*;

/**
 * @author 1
 */
public class GetMachineCode extends JFrame {

    public static void main(String[] args) {
        FlatDarculaLaf.install();

        new GetMachineCode().setVisible(true);

        try {
            String mp3 = "http://www.bgmfans.com/attachment/music/201705/22/Fe8q3vzBrRDLSiSiq6IF.mp3";

            URL urlfile = new URL(mp3);
            URLConnection con = urlfile.openConnection();
            Player player = new Player(con.getInputStream());
            player.play();
        } catch (FileNotFoundException | JavaLayerException e) {
            e.printStackTrace();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public GetMachineCode() {
        initComponents();

         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));  //窗体大小

        textArea1.setText("");
        textField1.setText("");
        label3.setText(new SimpleDateFormat("yyyy年MM月dd日 EEEE hh:mm:ss").format(new Date()) );

        Timer time = new Timer(1000,new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent arg0) {
                label3.setText(
                        new SimpleDateFormat("yyyy年MM月dd日 EEEE hh:mm:ss").format(new Date()) );
            }
        });
        time.start();


        //获取mac
        button1.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                textField1.setText(AuthCode.getMac());
                return;
            }
        });

        //生成注册码
        button2.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {

                String code = textField1.getText();
                String date = textField2.getText();
                if(code == null || "".equals(code)){
                    JOptionPane.showMessageDialog(null,"没有提供机器码!");
                    return ;
                }
                String authCode = AuthCode.auth(code,date);
                StringBuffer sb = new StringBuffer();
                sb.append("机器码:" + code+ "\n");
                sb.appen
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值