1 16 package net.sf.jftp.gui.base; 17 18 import net.sf.jftp.*; 19 import net.sf.jftp.gui.framework.*; 20 import net.sf.jftp.system.logging.Log; 21 import net.sf.jftp.util.*; 22 23 import java.awt.*; 24 import java.awt.event.*; 25 26 import java.io.*; 27 28 29 public class Properties extends HFrame implements ActionListener 30 { 31 private Label fileL = new Label("File: "); 32 private Label sizeL = new Label("Size: ? bytes "); 33 private HButton ok = new HButton("Dismiss"); 34 private HPanel okP = new HPanel(); 35 private String type = ""; 36 private String file = ""; 37 38 public Properties(String file, String type) 39 { 40 this.file = file; 41 this.type = type; 42 43 setSize(300, 110); 44 setTitle("File properties..."); 45 setLocation(150, 150); 46 setLayout(new GridLayout(3, 1)); 47 48 okP.add(ok); 49 add(sizeL); 50 add(fileL); 51 add(okP); 52 ok.addActionListener(this); 53 54 process(); 55 setVisible(true); 56 } 57 58 private void process() 59 { 60 if(type.equals("local")) 61 { 62 File f = new File(JFtp.localDir.getPath() + file); 63 sizeL.setText("Size: " + Long.toString(f.length()) + " bytes"); 64 65 try 66 { 67 fileL.setText("File: " + f.getCanonicalPath()); 68 } 69 catch(Exception ex) 70 { 71 Log.debug(ex.toString()); 72 } 73 74 sizeL.setText("Size: " + Long.toString(f.length()) + " bytes"); 75 } 76 77 if(type.equals("remote")) 78 { 79 fileL.setText("File: " + JFtp.remoteDir.getPath() + file); 80 } 81 } 82 83 public void actionPerformed(ActionEvent e) 84 { 85 if(e.getSource() == ok) 86 { 87 setVisible(false); 88 } 89 } 90 } 91 | Popular Tags |