Results 1 to 3 of 3
Thread: how to get exact file path
- 02-06-2012, 09:53 AM #1
Senior Member
- Join Date
- Jan 2012
- Location
- TamilNadu
- Posts
- 162
- Rep Power
- 2
how to get exact file path
Hi!
I wants to get exact file for my program,
i add my problematic code with this thread,
so many i choose a correct file by file chooser.
But it is not taken its file please help my brother..,
Java Code:import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; public class FileSelect extends JFrame implements ActionListener { JLabel label_1; JLabel label_2; JLabel label_3; TextField textfield_1; JLabel label_4; JTextField textfield_2; JButton button_3; JButton button_2; JButton button_1; Panel p; JButton button_4; FileDialog fd1; Dialog d; String s,temp; String s1,s2; public FileSelect() { FileSelectLayout customLayout = new FileSelectLayout(); getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12)); getContentPane().setLayout(customLayout); label_1 = new JLabel("DATA SECURITY USING CRYPTOGRAPHY AND STEGANOGRAPHY"); getContentPane().add(label_1); label_2 = new JLabel("DES Encryption:-"); getContentPane().add(label_2); label_3 = new JLabel("Enter Encryption Key :-"); getContentPane().add(label_3); textfield_1 = new TextField(""); getContentPane().add(textfield_1); label_4 = new JLabel("Select the File :-"); getContentPane().add(label_4); textfield_2 = new JTextField(""); getContentPane().add(textfield_2); button_2 = new JButton("Browse"); getContentPane().add(button_2); button_1 = new JButton("Start Encryption"); getContentPane().add(button_1); button_3 = new JButton("<<Back"); getContentPane().add(button_3); button_4 = new JButton("OK"); getContentPane().add(button_4); d=new Dialog(this,"Error with Entry !"); button_1.addActionListener(this); button_2.addActionListener(this); button_3.addActionListener(this); button_4.addActionListener(this); textfield_1.setEchoChar('*'); fd1=new FileDialog(this,"Open the file",FileDialog.LOAD); d=new Dialog(this,"mistake in Entry"); d.setSize(100,100); p=new Panel(); button_4 = new JButton("Ok"); button_4.addActionListener(this); p.add(button_4); d.add(p); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } public void actionPerformed(ActionEvent e) { if (e.getSource()==button_1) // Start Encryption { // if 1 // Clear the temp Files File f11=new File("../CryptoStegno/src/TwoOfAbove/test.txt"); File f22=new File("../CryptoStegno/src/TwoOfAbove/dec1.txt"); f11.delete(); f22.delete(); //-----------------------------------------------------------------------// s1=textfield_2.getText(); // file s2=textfield_1.getText(); // key System.out.println(s2); // key1 System.out.println(s1); // File File f=new File(s1); int i1=s2.length(); int k1=1; int flag=0; if(f.isFile()) :(devil): [SIZE=7][FONT=impact] (here is my problem Brother)[/FONT][/SIZE] { // 2 k1=0; } // 2 System.out.println("\n this "+k1); if(i1!=8 || k1==1) // if error in entry { // 3 d.show(); } // 3 //--------------------------------TRIPLE-DES STEP1 START--------------------------------------// else { // else 1 System.out.print("test\n"); if(s2.length() != 8) { // 4 System.out.print("Error on 116\n"); } //4 else { // else at 136 char key[]=new char[8]; key[0]=s2.charAt(0);
I am waiting for your ans pls help me..,
- 02-06-2012, 11:41 AM #2
Senior Member
- Join Date
- Jan 2012
- Location
- TamilNadu
- Posts
- 162
- Rep Power
- 2
Re: how to get exact file path
i have correct the error myself,
Thank you gentles..,
- 02-06-2012, 11:45 AM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,424
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
file path
By billq in forum New To JavaReplies: 2Last Post: 04-11-2010, 05:47 PM -
ant with a jar file in path to run
By javastuden in forum Advanced JavaReplies: 0Last Post: 02-22-2010, 05:59 AM -
file path
By ras_pari in forum Advanced JavaReplies: 2Last Post: 10-12-2009, 11:25 AM -
file path
By Arsench in forum New To JavaReplies: 7Last Post: 10-30-2008, 05:39 AM -
How can you get the exact size of a file in bytes.
By J-Live in forum New To JavaReplies: 7Last Post: 10-28-2008, 01:41 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks