資源簡介
圖片加密,解密程序,有源碼.使用:輸入圖片所在文件夾,格式d:\\xxx\\;需要自己安裝jdk才可運行,jdk1.7,1.8

代碼片段和文件信息
package?com.study.second.photodear;
import?java.awt.Color;
import?java.awt.Font;
import?java.awt.GridLayout;
import?java.awt.event.ActionEvent;
import?java.awt.event.ActionListener;
import?java.awt.image.BufferedImage;
import?java.io.ByteArrayInputStream;
import?java.io.ByteArrayOutputStream;
import?java.io.File;
import?java.io.FileInputStream;
import?java.io.FileOutputStream;
import?java.io.IOException;
import?java.util.ArrayList;
import?java.util.Arrays;
import?java.util.base64;
import?java.util.List;
import?java.util.Vector;
import?java.util.concurrent.CompletableFuture;
import?java.util.concurrent.ExecutorService;
import?java.util.concurrent.Executors;
import?java.util.function.Supplier;
import?javax.imageio.ImageIO;
import?javax.swing.JButton;
import?javax.swing.Jframe;
import?javax.swing.JLabel;
import?javax.swing.JPanel;
import?javax.swing.JTextField;
public?class?ImageBinary?extends?Jframe?implements?ActionListener{
ExecutorService?executor=Executors.newFixedThreadPool(1);
//圖片地址文本框
private?JTextField?resultText1=new?JTextField(“圖片地址“);
private?JTextField?resultText2=new?JTextField(“編碼地址“);
private?JTextField?resultText3=new?JTextField(“編碼地址“);
private?JTextField?resultText4=new?JTextField(“解碼地址“);
private?JLabel?m=null;
private?JLabel?divide=null;
private?JLabel?s=null;
private?int?i=0j=0;
private?boolean?run=true;
private?int?type0=0;//編碼圖片
private?int?type1=1;//解碼圖片
public?ImageBinary(){
super();
init();
this.setBackground(Color.LIGHT_GRAY);
this.settitle(“圖片編碼工具“);
this.setLocation(500?300);
//允許修改大小
this.setResizable(true);
this.pack();
}
// public?static?void?main1(String[]?args)?throws?IOException?{
// String?fileName?=?“D://code//22.jpg“;
// //System.out.println(“---“+getImageBinary(fileName));
// FileOutputStream?fo=new?FileOutputStream(new?File(“d:\\code\\test.txt“));
// fo.write(getImageBinary(fileName).getBytes());
// saveImage(getImageBinary(fileName));
// }
public?void?init(){
JPanel?encode=new?JPanel();
encode.setLayout(new?GridLayout(1?3?3?3));
encode.add(resultText1);
encode.add(resultText2);
JButton?encodeButton=new?JButton(“編碼“);
encodeButton.setForeground(Color.BLUE);
encode.add(encodeButton);
encodeButton.addActionListener(this);
JPanel?decode=new?JPanel();
decode.setLayout(new?GridLayout(1?3?3?3));
decode.add(resultText3);
decode.add(resultText4);
JButton?decodeButton=new?JButton(“解碼“);
decodeButton.setForeground(Color.BLUE);
decode.add(decodeButton);
decodeButton.addActionListener(this);
m=new?JLabel(“0“);
divide=new?JLabel(“:“);
s=new?JLabel(“00“);
m.setFont(new?Font(“Consulas“Font.PLAIN36));
divide.setFont(new?Font(“Consulas“Font.PLAIN36));
s.setFont(new?Font(“Consulas“Font.PLAIN36));
JPanel?center=new?JPanel();
center.add(m);
center.add(divide);
center.add(s);
JPanel?bottom=new?JPanel();
bott
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-11-27?18:28??photo\
?????目錄???????????0??2018-11-27?09:58??photo\com\
?????目錄???????????0??2018-11-27?09:58??photo\com\study\
?????目錄???????????0??2018-11-27?09:58??photo\com\study\second\
?????目錄???????????0??2018-11-27?18:23??photo\com\study\second\photodear\
?????文件????????4455??2018-11-27?09:37??photo\com\study\second\photodear\ImageBinary.class
?????文件????????9295??2018-11-27?18:18??photo\com\study\second\photodear\ImageBinary.java
?????目錄???????????0??2018-11-27?09:58??photo\me
?????文件??????????77??2018-11-27?10:00??photo\me
?????文件??????454656??2018-11-27?18:26??photo\photo.exe
?????文件????????7101??2018-11-27?18:21??photo\photo.jar
- 上一篇:PPT倒計時定時器
- 下一篇:基于openGL、pygame增強現實的視頻實現代碼
評論
共有 條評論