Professional Documents
Culture Documents
Compliance Code
Compliance Code
Color;
import java.awt.EventQueue;
import java.awt.*;
import java.util.*;
import java.util.List;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Compliance frame = new Compliance();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public Compliance() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 828, 476);
contentPane = new JPanel();
contentPane.setBackground(Color.LIGHT_GRAY);
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
btnUpload.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
File ff;
PDFManager pdfManager = new PDFManager();
JFileChooser jf = new JFileChooser();
int aa = jf.showOpenDialog(null);
if(aa==JFileChooser.APPROVE_OPTION) {
ff=jf.getSelectedFile();
textField.setText(ff.getAbsolutePath());
String filePath = ff.getAbsolutePath();
pdfManager.setFilePath(filePath);
FileReader fr;
try {
for(String name : nameToSearch) {
fr = new FileReader("D:\\file.txt");
BufferedReader br=new BufferedReader(fr);
String s;
String line1;
String line2;
String line3;
String searchID = "QDi";
int linecount=0;
String line;
//String words[]=new String[500];
while ((s=br.readLine())!=null)
{
linecount++;
int
indexfound=s.toLowerCase().indexOf(name.toLowerCase());
if (indexfound>-
1)
{
//System.out.println("\n");
System.out.println("\n");
line=s;
System.out.println(line);
line1 =
br.readLine();
line2 =
br.readLine();
line3 =
br.readLine();
if(line1.toLowerCase().indexOf(searchID.toLowerCase()) != -1 ) {
System.out.println(line1);
}
System.out.println(line2);
System.out.println(line3);
//
int idx=0;
//
StringTokenizer st= new StringTokenizer(line);
//
tokencount= st.countTokens();
//
System.out.println("\n");
//
System.out.println("Number of tokens found" +tokencount);
//
System.out.println("\n");
//
for (idx=0;idx<tokencount;idx++)
//
{
//
words[idx]=st.nextToken();
//
System.out.println(words[idx]);
//
}
}
fr.close();
}
System.out.println("DONE");
}
}
});
btnUpload.setBounds(128, 195, 383, 23);
contentPane.add(btnUpload);