package test;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Region;
import org.eclipse.wb.swt.SWTResourceManager;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Button;
public class dcAesT {
protected Shell shell;
private Text text;
private Text text_1;
/**
* Launch the application.
* @param args
*/
public static void main(String[] args) {
try {
dcAesT window = new dcAesT();
window.open();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Open the window.
*/
public void open() {
Display display = Display.getDefault();
createContents();
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
/**
* Create contents of the window.
*/
protected void createContents() {
//setResizable()display, SWT.DIALOG_TRIM
shell = new Shell(SWT.MIN);
// shell.close();
shell.setTouchEnabled(true);
shell.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
shell.setSize(572, 497);
shell.setText("编码/解码");
shell.setLayout(null);
Label lblNewLabel = new Label(shell, SWT.NONE);
lblNewLabel.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
lblNewLabel.setFont(SWTResourceManager.getFont("楷体", 16, SWT.NORMAL));
lblNewLabel.setText("编码/解码器");
lblNewLabel.setBounds(212, 24, 121, 26);
Label lblNewLabel_1 = new Label(shell, SWT.NONE);
lblNewLabel_1.setFont(SWTResourceManager.getFont("仿宋", 11, SWT.NORMAL));
lblNewLabel_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
lblNewLabel_1.setBounds(22, 78, 257, 20);
lblNewLabel_1.setText("请输入要进行的编码或解码的字符:");
text = new Text(shell, SWT.BORDER);
text.setTouchEnabled(true);
text.setFont(SWTResourceManager.getFont("宋体", 11, SWT.NORMAL));
text.setBounds(22, 114, 505, 95);
Button btnNewButton = new Button(shell, SWT.NONE);
btnNewButton.setFont(SWTResourceManager.getFont("楷体", 16, SWT.NORMAL));
btnNewButton.setForeground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
btnNewButton.setBounds(22, 215, 80, 46);
btnNewButton.setText("加密");
btnNewButton.addSelectionListener(new SelectionAdapter(){
public void widgetSelected(SelectionEvent e) {
String aa = text.getText();
//String replace = aa.replace(textField_1);
char bb[] = aa.toCharArray();
char cc[] = new char[bb.length];
for(int i = 0; i < bb.length;i++){
cc[i] = (bb[i]);
}
DcAesUtil d = new DcAesUtil();
text_1.setText(d.encodeAesBase64(String.valueOf(cc)));
//textField_1.setText("okokokko");
}
});
Button button = new Button(shell, SWT.NONE);
// button.setBackground(red);
button.setText("解密");
button.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE));
button.setFont(SWTResourceManager.getFont("楷体", 16, SWT.NORMAL));
button.setBounds(133, 215, 80, 46);
button.addSelectionListener(new SelectionAdapter(){
public void widgetSelected(SelectionEvent e) {
try{
String aa = text.getText();
//String replace = aa.replace(textField_1);
char bb[] = aa.toCharArray();
char cc[] = new char[bb.length];
for(int i = 0; i < bb.length;i++){
cc[i] = (bb[i]);
}
DcAesUtil d = new DcAesUtil();
text_1.setText(d.decoderAesBase64(String.valueOf(cc)));
//textField_1.setText("okokokko");
}catch(Exception e1){
JOptionPane.showMessageDialog(null, "操作不正确","提示", JOptionPane.INFORMATION_MESSAGE);
System.out.println("错误操作");
}
}
});
Label lblAes = new Label(shell, SWT.NONE);
lblAes.setText("AES编码或解码结果:");
lblAes.setFont(SWTResourceManager.getFont("仿宋", 11, SWT.NORMAL));
lblAes.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
lblAes.setBounds(22, 279, 257, 20);
text_1 = new Text(shell, SWT.BORDER);
text_1.setBounds(29, 322, 498, 88);
text_1.setEditable(false);
}
}
最近下载更多
最近浏览更多
qq1176648922 LV6
2022年10月24日
1358849392 LV21
2022年10月21日
1435792946 LV1
2022年5月9日
zzuljh LV9
2021年12月16日
a5366869 LV7
2021年9月20日
itcaizhe LV9
2021年7月26日
1798672867 LV21
2021年7月18日
lris_luanling LV11
2021年5月27日
wwkddjjj LV8
2021年5月9日
zyzyzy1 LV1
2021年5月6日

