1 16 package net.sf.jftp.util; 17 18 import net.sf.jftp.*; 19 import net.sf.jftp.config.*; 20 import net.sf.jftp.gui.framework.*; 21 import net.sf.jftp.net.*; 22 import net.sf.jftp.util.*; 23 24 import java.awt.*; 25 import java.awt.event.*; 26 27 import java.io.*; 28 29 import java.util.*; 30 31 import javax.swing.*; 32 import javax.swing.event.*; 33 34 35 public class JHostChooser extends HFrame implements ActionListener 36 { 37 private JLabel hostL = new JLabel("Host:"); 38 private JLabel portL = new JLabel("Port:"); 39 private JTextField host = new JTextField(20); 40 private JTextField port = new JTextField(5); 41 private JPanel p1 = new JPanel(); 42 private JPanel okP = new JPanel(); 43 private JButton ok = new JButton("Use these settings"); 44 45 public JHostChooser() 46 { 47 setSize(400, 120); 48 setLocation(200, 250); 49 setTitle("Connection..."); 50 getContentPane().setLayout(new BorderLayout()); 51 setBackground(Color.lightGray); 52 53 p1.add(hostL); 54 p1.add(host); 55 p1.add(portL); 56 p1.add(port); 57 58 host.setText(RawConnection.host.getText()); 59 port.setText(RawConnection.port.getText()); 60 61 getContentPane().add("Center", p1); 62 getContentPane().add("South", okP); 63 okP.add(ok); 64 ok.addActionListener(this); 65 66 setVisible(true); 67 } 68 69 public void actionPerformed(ActionEvent e) 70 { 71 if(e.getSource() == ok) 72 { 73 RawConnection.host.setText(host.getText()); 74 RawConnection.port.setText(port.getText()); 75 RawConnection.established = false; 76 RawConnection.mayDispose = true; 77 this.dispose(); 78 } 79 } 80 81 public Insets getInsets() 82 { 83 Insets std = super.getInsets(); 84 85 return new Insets(std.top + 5, std.left + 5, std.bottom + 5, 86 std.right + 5); 87 } 88 } 89 | Popular Tags |