view rep/gui/ConnectionPanel.java @ 133:8dce4348966c

*** empty log message ***
author kono
date Wed, 27 Aug 2008 18:27:12 +0900
parents 91a33a634fef
children
line wrap: on
line source

package rep.gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTextField;

import rep.ConnectionListener;

public class ConnectionPanel extends JPanel implements ActionListener{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JButton button;
	private JTextField textField;
	public String host;

	public ConnectionPanel(ConnectionListener connectionlistener){
		button = new JButton("Connect");
		textField = new JTextField("localhost");
		
		button.setBounds(160, 5, 100, 20);
		textField.setBounds(5, 5, 150, 20);

		this.setLayout(null);
		this.add(textField);
		this.add( button);
		
		button.addActionListener(this);
	}


	public ConnectionPanel() {		
		button = new JButton("Connect");
		textField = new JTextField("localhost");
	
		button.setBounds(160, 5, 100, 20);
		textField.setBounds(5, 5, 150, 20);

		this.setLayout(null);
		this.add(textField);
		this.add( button);
	
		button.addActionListener(this);
	}


	public void actionPerformed(ActionEvent event) {
		// TODO Auto-generated method stub
		if (event.getSource() == button) {
			host = textField.getText();
			System.out.println("pressed!");
		}
	}

}