view rep/gui/ConnectionPanel.java @ 5:91a33a634fef

*** empty log message ***
author pin
date Thu, 18 Oct 2007 13:27:06 +0900
parents
children 8dce4348966c
line wrap: on
line source

package rep.gui;

import java.awt.LayoutManager;
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 JButton button;
	private JTextField textField;
	private 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!");
		}
	}

}