view rep/SessionManagerGUI.java @ 8:b774b87cc2c1

*** empty log message ***
author pin
date Fri, 19 Oct 2007 15:34:27 +0900
parents 91a33a634fef
children 57a16534ba5a
line wrap: on
line source

package rep;

import java.awt.BorderLayout;
import java.awt.Container;
import java.nio.channels.SocketChannel;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import rep.gui.ConnectionPanel;

public class SessionManagerGUI implements Runnable{
	public static void main(String[] args) {
		SessionManagerGUI gui = new SessionManagerGUI();
		Thread th = new Thread( gui ); 
		th.start();
	}

	private RPanel rp;
	//private ConnectionPanel rp;
	private JFrame frame;

	public void run() {
		frame = new JFrame("SessionManager");
		frame.setBounds(100, 100, 400, 300);
		//rp =  new ConnectionPanel();
		rp = new RPanel();
		Container cont = frame.getContentPane();
		cont.add(rp);

		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		//frame.pack();
		frame.setVisible(true);
	}

	public void addConnectionListener(ConnectionListener listener) {
		//System.out.println(rp.toString());
		System.out.print("waiting for launching GUI.");
		while(rp == null){
			System.out.print(".");
			try {
				Thread.sleep(200);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		System.out.println("");
		rp.addConnectionListener(listener);
	}

	public void setComboEditor(int eid, SocketChannel channel) {
		// TODO Auto-generated method stub
		rp.setComboEditor(eid, channel);
	}

	public void addREPActionListener(REPActionListener listener) {
		// TODO Auto-generated method stub
		rp.REPActionListener(listener);
	}

	public void setComboSession(int sessionID, String string) {
		// TODO Auto-generated method stub
		rp.setComboSession(sessionID, string);
	}
}