01: /*
02: * This program is free software; you can redistribute it and/or
03: * modify it under the terms of the GNU General Public License
04: * as published by the Free Software Foundation; either version 2
05: * of the License, or (at your option) any later version.
06: *
07: * This program is distributed in the hope that it will be useful,
08: * but WITHOUT ANY WARRANTY; without even the implied warranty of
09: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10: * GNU General Public License for more details.
11:
12: * You should have received a copy of the GNU General Public License
13: * along with this program; if not, write to the Free Software
14: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15: */
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: public class JHostChooser extends HFrame implements ActionListener {
35: private JLabel hostL = new JLabel("Host:");
36: private JLabel portL = new JLabel("Port:");
37: private JTextField host = new JTextField(20);
38: private JTextField port = new JTextField(5);
39: private JPanel p1 = new JPanel();
40: private JPanel okP = new JPanel();
41: private JButton ok = new JButton("Use these settings");
42:
43: public JHostChooser() {
44: setSize(400, 120);
45: setLocation(200, 250);
46: setTitle("Connection...");
47: getContentPane().setLayout(new BorderLayout());
48: setBackground(Color.lightGray);
49:
50: p1.add(hostL);
51: p1.add(host);
52: p1.add(portL);
53: p1.add(port);
54:
55: host.setText(RawConnection.host.getText());
56: port.setText(RawConnection.port.getText());
57:
58: getContentPane().add("Center", p1);
59: getContentPane().add("South", okP);
60: okP.add(ok);
61: ok.addActionListener(this );
62:
63: setVisible(true);
64: }
65:
66: public void actionPerformed(ActionEvent e) {
67: if (e.getSource() == ok) {
68: RawConnection.host.setText(host.getText());
69: RawConnection.port.setText(port.getText());
70: RawConnection.established = false;
71: RawConnection.mayDispose = true;
72: this .dispose();
73: }
74: }
75:
76: public Insets getInsets() {
77: Insets std = super .getInsets();
78:
79: return new Insets(std.top + 5, std.left + 5, std.bottom + 5,
80: std.right + 5);
81: }
82: }
|