des加密算法的JAVA实现(窗口的实现部分)

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

以下为DES加密算法的实现(附控制台输出调试代码)/**Window.java**Createdon__DATE__,__TIME__*/packagedeswindow;importjava.util.Scanner;/****@author__USER__*/publicclassWindowextendsjavax.swing.JFrame{/**CreatesnewformWindow*/publicWindow(){initComponents();}/**Thismethodiscalledfromwithintheconstructorto*initializetheform.*WARNING:DoNOTmodifythiscode.Thecontentofthismethodis*alwaysregeneratedbytheFormEditor.*///GEN-BEGIN:initComponents//editor-folddefaultstate=collapseddesc=GeneratedCodeprivatevoidinitComponents(){button1=newjava.awt.Button();textField1=newjava.awt.TextField();textField2=newjava.awt.TextField();内容=newjava.awt.Label();密钥=newjava.awt.Label();textArea1=newjava.awt.TextArea();button2=newjava.awt.Button();setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);button1.setLabel(加密);button1.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){button1ActionPerformed(evt);}});textField1.setText(请输入明文或者密文);textField1.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){textField1ActionPerformed(evt);}});textField2.setText(请输入密钥);textField2.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){textField2ActionPerformed(evt);}});内容.setText(内容);密钥.setText(密钥);button2.setLabel(解密);button2.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){button2ActionPerformed(evt);}});javax.swing.GroupLayoutlayout=newjavax.swing.GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(127,127,127).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(textArea1,javax.swing.GroupLayout.Alignment.TRAILING,javax.swing.GroupLayout.DEFAULT_SIZE,124,Short.MAX_VALUE).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(javax.swing.GroupLayout.Alignment.TRAILING,layout.createSequentialGroup().addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(内容,javax.swing.GroupLayout.PREFERRED_SIZE,38,javax.swing.GroupLayout.PREFERRED_SIZE)).addComponent(密钥,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)).addGap(2,2,2).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(textField1,javax.swing.GroupLayout.DEFAULT_SIZE,84,Short.MAX_VALUE).addComponent(textField2,javax.swing.GroupLayout.DEFAULT_SIZE,84,Short.MAX_VALUE)))).addGroup(layout.createSequentialGroup().addComponent(button1,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(button2,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE))).addGap(149,149,149)));layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(29,29,29).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(textField1,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(内容,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(密钥,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(textField2,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(button2,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(button1,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(textArea1,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE).addContainerGap(91,Short.MAX_VALUE)));pack();}///editor-fold//GEN-END:initComponentsprivatevoidbutton2ActionPerformed(java.awt.event.ActionEventevt){//解密得到两个输入框的输入值textArea1.setText();//textArea1.append(欢迎使用64位DES加密解密

1 / 8
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功