欢迎来到天天文库
浏览记录
ID:37669862
大小:50.25 KB
页数:19页
时间:2019-05-28
《带界面的AES算法Java实现》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、.界面效果:窗口操作界面源代码importjava.awt.BorderLayout;importjava.awt.Container;importjava.awt.FlowLayout;importjava.awt.GridLayout;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.awt.event.WindowAdapter;importjava.awt.event.WindowEvent;impo
2、rtjava.io.File;importjavax.swing.ButtonGroup;importjavax.swing.JButton;importjavax.swing.JFileChooser;importjavax.swing.JFrame;importjavax.swing.JLabel;importjavax.swing.JOptionPane;importjavax.swing.JPanel;importjavax.swing.JRadioButton;importjavax.swing.JText
3、Field;importjavax.swing.SwingConstants;publicclassAESFrameextendsJFrameimplementsActionListener{privateJLabelsourceLabel,aimLabel,keyLabel;privateJTextFieldsourceText,aimText,keyText;privateJButtonencryptBt,decryptBt,clearBt,exitBt, selectSourceBt,selectAimBt;p
4、rivateJRadioButton[]methodRadioButtons=newJRadioButton[2];privateButtonGroupmethodGroup=newButtonGroup();..publicstaticvoidmain(String[]args){newAESFrame("AES加密解密工具By:***");}publicAESFrame(Stringtitle){super(title);//初始化组件keyLabel=newJLabel("密钥",SwingConstants.
5、RIGHT);sourceLabel=newJLabel("源文件", SwingConstants.RIGHT);aimLabel=newJLabel("目标文件",SwingConstants.RIGHT);keyText=newJTextField(20);sourceText=newJTextField(20);aimText=newJTextField(20);encryptBt=newJButton("加密");decryptBt=newJButton("解密");clearBt=newJButton("
6、清空");exitBt=newJButton("退出");selectSourceBt=newJButton("浏览");selectAimBt=newJButton("浏览");methodRadioButtons[0]=newJRadioButton("文件");methodRadioButtons[1]=newJRadioButton("字符串");methodGroup.add(methodRadioButtons[0]);methodGroup.add(methodRadioButtons[1]);meth
7、odRadioButtons[0].setSelected(true);//划分面板Containerc=this.getContentPane();c.setLayout(newBorderLayout());JPanelcenterPanel=newJPanel();JPanelnorthPanel=newJPanel();JPanelsouthPanel=newJPanel();JPaneleastPanel=newJPanel();JPanelwestPanel=newJPanel();c.add(eastP
8、anel,BorderLayout.EAST);c.add(westPanel,BorderLayout.WEST);..northPanel.setLayout(newGridLayout(1,3));JPanelnorthLeftPanel=newJPanel();JPanelnorthCenterPanel=newJPanel();JPa
此文档下载收益归作者所有