1、import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JRadioButton;import javax.swing.JTextField;import javax.swing.SwingConstants;public class AESFrame extends JFrame implements ActionListener private JLabel sourceLabel, aimL
2、abel, keyLabel;private JTextField sourceText, aimText, keyText;private JButton encryptBt, decryptBt, clearBt, exitBt, selectSourceBt, selectAimBt;private JRadioButton methodRadioButtons=new JRadioButton2;private ButtonGroup methodGroup=new ButtonGroup();public static void main(String args)new AESFra
3、me(AES加密解密工具 By:*);public AESFrame(String title)super(title);/初始化组件keyLabel = new JLabel(密钥, SwingConstants.RIGHT);sourceLabel = new JLabel(源文件, SwingConstants.RIGHT);aimLabel = new JLabel(目标文件keyText = new JTextField(20);sourceText = new JTextField(20);aimText = new JTextField(20);encryptBt = new J
4、Button(加密decryptBt = new JButton(解密clearBt = new JButton(清空exitBt = new JButton(退出selectSourceBt = new JButton(浏览selectAimBt = new JButton(methodRadioButtons0 = new JRadioButton(文件methodRadioButtons1 = new JRadioButton(字符串methodGroup.add(methodRadioButtons0);methodGroup.add(methodRadioButtons1);meth
5、odRadioButtons0.setSelected(true);/划分面板Container c = this.getContentPane();c.setLayout(new BorderLayout();JPanel centerPanel = new JPanel();JPanel northPanel = new JPanel();JPanel southPanel = new JPanel();JPanel eastPanel = new JPanel();JPanel westPanel = new JPanel();c.add(eastPanel, BorderLayout.
6、EAST);c.add(westPanel, BorderLayout.WEST); northPanel.setLayout(new GridLayout(1, 3);JPanel northLeftPanel = new JPanel();JPanel northCenterPanel = new JPanel();JPanel northRightPanel = new JPanel();northCenterPanel.setLayout(new FlowLayout();northCenterPanel.add(methodRadioButtons0);northCenterPane
7、l.add(methodRadioButtons1);northPanel.add(northLeftPanel);northPanel.add(northCenterPanel);northPanel.add(northRightPanel);c.add(northPanel, BorderLayout.NORTH);southPanel.setLayout(new GridLayout(1, 2);JPanel southLeftPanel = new JPanel(new FlowLayout();JPanel southRightPanel = new JPanel(new FlowL
8、ayout();southLeftPanel.add(encryptBt);southLeftPanel.add(decryptBt);southRightPanel.add(clearBt);southRightPanel.add(exitBt);southPanel.add(southLeftPanel);southPanel.add(southRightPanel);c.add(southPanel, BorderLayout.SOUTH);centerPanel.setLayout(new BorderLayout();JPanel centerEastPanel = new JPan
9、el(new GridLayout(3, 1);JPanel centerWestPanel = new JPanel(new GridLayout(3, JPanel centerCenterPanel = new JPanel(new GridLayout(3, JPanel centerSouthPanel = new JPanel();JPanel centerNorthPanel = new JPanel();JPanel panel1 = new JPanel(new FlowLayout();JPanel panel2 = new JPanel(new FlowLayout();
10、JPanel panel3 = new JPanel(new FlowLayout();JPanel panel4 = new JPanel(new FlowLayout();JPanel panel5 = new JPanel(new FlowLayout();JPanel panel6 = new JPanel(new FlowLayout();JPanel panel7 = new JPanel(new FlowLayout();JPanel panel8 = new JPanel(new FlowLayout();JPanel panel9 = new JPanel(new FlowL
11、ayout();panel1.add(sourceLabel);panel2.add(sourceText);panel3.add(selectSourceBt);panel4.add(aimLabel);panel5.add(aimText);panel6.add(selectAimBt);panel7.add(keyLabel);panel8.add(keyText);centerWestPanel.add(panel1);centerWestPanel.add(panel4);centerWestPanel.add(panel7);centerCenterPanel.add(panel2
12、);centerCenterPanel.add(panel5);centerCenterPanel.add(panel8);centerEastPanel.add(panel3);centerEastPanel.add(panel6);centerEastPanel.add(panel9);centerPanel.add(centerEastPanel, BorderLayout.EAST);centerPanel.add(centerWestPanel, BorderLayout.WEST);centerPanel.add(centerCenterPanel, BorderLayout.CE
13、NTER);centerPanel.add(centerSouthPanel, BorderLayout.SOUTH);centerPanel.add(centerNorthPanel, BorderLayout.NORTH);c.add(centerPanel, BorderLayout.CENTER);/加入按钮监听encryptBt.addActionListener(this);decryptBt.addActionListener(this);clearBt.addActionListener(this);exitBt.addActionListener(this);selectSourceBt.addActionListener(this);selectAimBt.addActionListener(this);metho
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1