1 16 package net.sf.jftp.gui.tasks; 17 18 import net.sf.jftp.*; 19 import net.sf.jftp.gui.framework.*; 20 import net.sf.jftp.net.*; 21 import net.sf.jftp.system.logging.Log; 22 import net.sf.jftp.util.*; 23 24 import java.awt.*; 25 import java.awt.event.*; 26 27 import java.io.*; 28 29 import javax.swing.*; 30 31 32 public class RemoteCommand extends HFrame implements ActionListener 33 { 34 private HTextField text; 35 private HButton ok = new HButton("Execute"); 36 37 public RemoteCommand() 38 { 39 setTitle("Choose command..."); 41 setLocation(150, 150); 42 getContentPane().setLayout(new FlowLayout()); 43 44 text = new HTextField("Command:", "SITE CHMOD 755 file", 30); 45 getContentPane().add(text); 46 getContentPane().add(ok); 47 ok.addActionListener(this); 48 text.text.addActionListener(this); 49 50 pack(); 51 setVisible(true); 52 } 53 54 public void actionPerformed(ActionEvent e) 55 { 56 if((e.getSource() == ok) || (e.getSource() == text.text)) 57 { 58 setVisible(false); 59 60 String cmd = text.getText(); 61 Log.debug("-> " + cmd); 62 JFtp.remoteDir.getCon().sendRawCommand(cmd); 63 64 if(cmd.toUpperCase().trim().startsWith("QUIT")) 65 { 66 JFtp.statusP.jftp.safeDisconnect(); 67 68 return; 69 } 70 71 JDialog j = new JDialog(); 72 j.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); 73 j.setTitle("Command response"); 74 j.setLocation(150, 150); 75 76 JTextArea t = new JTextArea(); 77 JScrollPane logSp = new JScrollPane(t); 78 logSp.setMinimumSize(new Dimension(300, 200)); 79 80 t.setText(Log.getCache()); 81 j.getContentPane().setLayout(new BorderLayout(5, 5)); 82 j.getContentPane().add("Center", t); 83 j.setSize(new Dimension(400, 300)); 84 j.pack(); 85 j.setVisible(true); 86 87 JFtp.remoteUpdate(); 88 } 89 } 90 } 91 | Popular Tags |