資源簡介
LSB位圖隱寫java實現
代碼片段和文件信息
import?java.awt.Container;
import?java.awt.Image;
import?java.awt.event.ActionEvent;
import?java.awt.event.ActionListener;
import?java.awt.event.MouseAdapter;
import?java.awt.event.MouseEvent;
import?java.io.File;
import?java.io.IOException;
import?javax.imageio.ImageIO;
import?javax.swing.*;
public?class?FileChoose?extends?Jframe{
String?path=“example.bmp“;
String?str;
//C:\\Users\\john\\Desktop\\original_5MV1_7216000155f2118f.jpg“;
Jframe?jf=new?Jframe(“二十四位位圖隱寫“);
Container?container=jf.getContentPane();
JLabel?showpic=new?JLabel(“顯示文件路徑“JLabel.CENTER);
JLabel?pswtip=new?JLabel(“在此鍵入隱寫消息“);
JLabel?pathtip=new?JLabel(“請選擇要隱寫或要解析的24位位圖“);
JButton?okbutton=new?JButton(“隱寫“);
JButton?choose=new?JButton(“選擇文件“);
JButton?undo=new?JButton(“解析“);
JTextField?text=new?JTextField();
public?static?void?main(String[]?args)?{
//new?test().Createframe(“hello“);
//new?myframe().createframe();
//String?path;
FileChoose?frame=new?FileChoose();
//frame.setVisible(true);
//System.out.println(FileChoose.)
}
public?FileChoose()
{
super();
container.add(showpic);
container.add(okbutton);
container.add(choose);
container.add(text);
container.add(undo);
container.add(pswtip);
container.add(pathtip);
container.setLayout(null);
jf.setVisible(true);
jf.setSize(600550);
jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
okbutton.setBounds(400?40010030);
undo.setBounds(400?450?100?30);
choose.setBounds(250?32010030);
pathtip.setBounds(200?60?200?30);
text.setBounds(200?400?170?30);
showpic.setIcon(new?ImageIcon(“example.jpg“));
showpic.setHorizontalTextPosition(JLabel.CENTER);
showpic.setVerticalTextPosition(JLabel.BOTTOM);
pswtip.setBounds(80?400?12030);
jf.add(showpic);
showpic.setBounds(100?0?400400);
//setBounds(100100300200);
//settitle(“文件選擇對話框“);
//setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE);
JMenuBar?menuBar=new?JMenuBar();
JMenu?filemenu=new?JMenu(“文件“);
jf.setJMenuBar(menuBar);
menuBar.add(filemenu);
JMenuItem?open?=?new?JMenuItem(“打開“);
JMenuItem?exit?=?new?JMenuItem(“退出“);
filemenu.add(open);
filemenu.add(exit);
exit.addActionListener(new?ActionListener()
{
public?void?actionPerformed(ActionEvent?e)
{
System.exit(0);
}
});
/*
open.addActionListener(new?ActionListener()
{
public?void?actionPerformed?(ActionEvent?e)
{
JFileChooser?filechoose?=?new?JFileChooser();
int?returnval=filechoose.showOpenDialog(null);//getContentPane());
if(returnval==JFileChooser.APPROVE_OPTION)
{
File?pic?=?filechoose.getSelectedFile();
path=pic.getAbsolutePath();
Image?myimage?=null;
????????try{
????????????myimage=ImageIO.read(new?File(path));
????????}catch(IOException?ex){}
????????
showpic.setIcon(new?ImageIcon(myimage));
//showpic.setBounds(3
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????155574??2013-04-11?14:01??lsb\1.bmp
?????文件????????5402??2013-04-25?22:25??lsb\FileChoose.java
?????文件????????1302??2013-04-17?17:17??lsb\example.jpg
?????文件????????1412??2013-04-25?22:26??lsb\jiami.java
?????文件?????????596??2013-04-16?22:52??lsb\jiemi.java
?????目錄???????????0??2013-04-17?23:08??lsb\
評論
共有 條評論