package major;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import tools.update;
public class Test {
	private static boolean t=true;
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
//		OCR ocr=new OCR();
//		 try {
//			String maybe2 = new OCR().recognizeText(new  File("E:\\temp\\222.png"), "png");
//			update.updateFromWeb(maybe2,"E:\\temp\\222.txt",true);
//			System.out.println(maybe2);
//			System.out.println("**********");
//			//MyString str=new MyString();
//			//System.out.println(str.getString(maybe2));
//		} catch (Exception e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		} 
//		SoundServer s=new SoundServer();
//		s.playSound("E:\\111\\HOOK1.wav");
		 
		 
		 
		 Box form = Box.createVerticalBox();
			JTextField field = new JTextField(30);
			form.add(new JLabel("图片路径:"));
			final JFormattedTextField webUrl =
	                new JFormattedTextField();
			webUrl.setValue("e:/temp/");
			form.add(webUrl);
			JTextField field1 = new JTextField(30);
			form.add(new JLabel("保存路径:"));
			final JFormattedTextField saveUrl =
	                new JFormattedTextField();
			saveUrl.setValue("e:/temp/");
			form.add(saveUrl);
	        
	        JButton button=new JButton("开始");
	        button.addActionListener(new ActionListener() {
				
				@Override
				public void actionPerformed(ActionEvent e) {
					// TODO Auto-generated method stub
		    		String fileUrls=(String)webUrl.getValue();
					String maybe2;
					try {
						File file=new File(fileUrls);
						File[] tempList = file.listFiles();
						if(tempList==null){
							JOptionPane.showMessageDialog( null , "该文件夹为空,","提示" , JOptionPane.INFORMATION_MESSAGE) ;
							return;
						}
						for(int i=0;t&&i<tempList.length;i++){
							String type=tempList[i].getName().split("\\.")[tempList[i].getName().split("\\.").length-1];
							if(!type.equals("png")&&!type.equals("PNG")&&!type.equals("jpg")&&!type.equals("JPG")&&!type.equals("bmp")&&!type.equals("tiff")&&!type.equals("gif")
				        			&&!type.equals("pcx")&&!type.equals("tga")&&!type.equals("fpx")&&!type.equals("svg")&&!type.equals("psd")&&!type.equals("cdr")
				        			&&!type.equals("pcd")&&!type.equals("dxf")&&!type.equals("ufo")&&!type.equals("eps")&&!type.equals("ai")&&!type.equals("raw"))
				        	{
								continue;
							}else{
								String saveUrls=(String)saveUrl.getValue();
								String name=tempList[i].getName().split("/")[tempList[i].getName().split("/").length-1].split("\\.")[0];
								maybe2 = new OCR().recognizeText(tempList[i], type);
								update.updateFromWeb(maybe2,saveUrls+"/"+name+".txt",true);
							}
						}
					} catch (Exception e1) {
						// TODO Auto-generated catch block
						e1.printStackTrace();
					}
					
				}
			}); 
	        form.add(button);
//	        JButton button1=new JButton("停止");
//			button1.addActionListener(new ActionListener() {
//				@Override
//				public void actionPerformed(ActionEvent e) {
//					// TODO Auto-generated method stub
//					d.setT(false);
//					d=new Demo();
//				}
//			}); 
//	        form.add(button1);
			JFrame frame = new JFrame("User Information");
	        frame.getContentPane().add(form);
	        frame.pack();
	        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	        frame.setVisible(true);
			
			
			
	}
}
 最近下载更多
最近下载更多
                
                huang163zi     LV1
                2023年4月25日
            
            
        
                dengjunjun     LV15
                2023年3月26日
            
            
        
                yymftanghui     LV2
                2022年3月4日
            
            
        
                Chillax     LV1
                2021年12月2日
            
            
        
                shijinbiao2006     LV3
                2021年8月4日
            
            
        
                OrangeACE     LV1
                2021年3月2日
            
            
        
                yangyang11111111     LV1
                2020年10月26日
            
            
        
                Vicent250     LV1
                2020年8月6日
            
            
        
                htx1984     LV3
                2020年2月23日
            
            
        
                houliukou     LV38
                2020年2月17日
            
            
         最近浏览更多
最近浏览更多
                
                nhxzyx    
                2024年6月28日
            
            
                    暂无贡献等级
            
        
                3334004690     LV11
                2024年6月22日
            
            
        
                huang163zi     LV1
                2023年4月25日
            
            
        
                dengjunjun     LV15
                2023年3月26日
            
            
        
                harrison123     LV2
                2022年5月10日
            
            
        
                ruishent     LV6
                2022年3月9日
            
            
        
                502595347     LV1
                2022年1月13日
            
            
        
                Chillax     LV1
                2021年12月1日
            
            
        
                mlfreeman3    
                2021年10月11日
            
            
                    暂无贡献等级
            
        
                whfuai     LV14
                2021年8月19日
            
            
        
 
     
                 
                