java注册码
//哎....
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.ParseException;
import javax.swing.*;
import javax.swing.text.MaskFormatter;
public class CodeTest extends JFrame {
private static final long serialVersionUID = 1L;
private JFormattedTextField formatField = null;
private JButton ba = null;
private String pattern = "AAAAA-AAAAA-AAAAA-AAAAA";
private JLabel code = new JLabel("注册码: ");
private JLabel input = new JLabel("序列号: ");
private JTextField codeField = new JTextField();
private JLabel rel = new JLabel();
public CodeTest(){
init();
}
public void init(){
MaskFormatter mft = CodeTest.getFormatter(pattern);
mft.setPlaceholderCharacter('X');
formatField = new JFormattedTextField();
formatField = new JFormattedTextField();
mft.install(formatField);
this.setBounds(200, 200, 240, 240);
this.setResizable(false);
this.setLayout(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
formatField.setBounds(30, 30, 180, 25);
ba = new JButton("注册");
ba.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
if(formatField.getText().length() >= 1) {
}
String text = formatField.getText();
long vlong = getCode(text);
code.setText("注册码: (" + vlong + ")");
if((vlong + "").equals(codeField.getText())){
rel.setText("注册成功!");
System.exit(0);
} else {
rel.setText("注册失败!");
}
}
});
codeField.setBounds(30, 85, 180, 25);
code.setBounds(30, 60, 180, 25);
ba.setBounds(30, 125, 180, 25);
rel.setBounds(30, 155, 100, 25);
input.setForeground(Color.RED);
code.setForeground(Color.RED);
rel.setForeground(Color.RED);
input.setBounds(30, 5, 100, 25);
this.add(rel);
this.add(codeField);
this.add(input);
this.add(code);
this.add(ba);
this.add(formatField);
ba.setDefaultCapable(true);
this.setVisible(true);
}
public static void main(String[] args) {
new CodeTest();
}
public static MaskFormatter getFormatter(String pattern){
try {
return new MaskFormatter(pattern);
} catch (ParseException e) {
e.printStackTrace();
return null;
}
}
public long getCode(String text){
char [] chs = text.toCharArray();
long vlong = 0;
for(char c: chs){
if(c != '-'){
vlong += 199 * (int)c;
}
}
return vlong;
}
}
B. JAVA用户注册 (我要源代码)
跑这儿作家庭作业了? 如果连用哪种页面技术都不知道提的话,恐怕别人给你源代码你也看不懂哦,想想别人给你个tapestry、Wicket之类的写的代码,拿给老师肯定挨批的哟(一看就露馅了)。
C. Java如何实现软件注册功能
是联网注册还是单机注册?
联网的话就是你要写个接受手机软件发送的信息的服务端。
单机的话就是你要获得可以唯一标识手机的代码,告知你后通过一定算法得出注册码,然后发送给用户
D. java编程词典个人版如何跳过注册码
用文件夹内的exe替换安装目录的同名文件。
java编程词典个人版直接用文件夹内的exe替换安装目录的同名文件不需要客户获取注册码即可直接打开。
《Java编程词典(个人版)》是明日科技为Java各级程序开发人员和编程爱好者开发的专业编程资源库,它提供了海量的开发资源、丰富的实例项目、灵活的查询方式、多样的学习模式,既可以帮助零基础者快速入门,又可以帮助有一定基础者快速提升开发水平,更适合各级程序开发人员随时检索查询,随时粘贴复用。Java编程词典个人版是程序开发人员的左膀右臂,软件工程师必备的专业指南。