Mercurial > hg > RemoteEditor > REPSessionManager
view rep/RPanel.java @ 6:bdb91f4cea26
It Can connect SessionManagers each other.
author | pin |
---|---|
date | Fri, 19 Oct 2007 01:26:47 +0900 |
parents | 02fa9a68d9a2 |
children | b774b87cc2c1 |
line wrap: on
line source
package rep; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.AbstractButton; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollBar; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; public class RPanel extends JPanel implements ActionListener { private JButton button; private JTextField textField; private String host; private JLabel label; private JTextArea textArea; private JScrollBar scrollBar; private JScrollPane scrollPane; private SessionViewer sessionViewer; private JScrollPane viewerPane; private ConnectionListener listener; public RPanel() { button = new JButton("Connect"); textField = new JTextField("firefly.cr.ie.u-ryukyu.ac.jp"); textArea = new JTextArea(); label = new JLabel("test"); scrollPane = new JScrollPane(textArea); sessionViewer = new SessionViewer(); viewerPane = new JScrollPane(sessionViewer.getTree()); //scrollBar = new JScrollBar(JScrollBar.VERTICAL); button.setBounds(160, 5, 100, 20); textField.setBounds(5, 5, 150, 20); textArea.setEditable(false); textArea.setLineWrap(false); scrollPane.setBounds(5, 30, 200, 200); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); viewerPane.setBounds(5, 30, 200, 200); viewerPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); //scrollPane.setPreferredSize(new Dimension(200, 200)); //textArea.setBounds(5, 30, 200, 200); //textArea.add(scrollBar, BorderLayout.EAST); this.setLayout(null); this.add(textField); this.add( button); this.add(label); //this.add(textArea); //this.add(scrollPane, BorderLayout.CENTER); this.add(viewerPane, BorderLayout.CENTER); //this.add(label, BorderLayout.CENTER); button.addActionListener(this); } public void addSessionTree(int SID){ sessionViewer.addSessionTree(SID); } public void actionPerformed(ActionEvent event) { if (event.getSource() == button) { host = textField.getText(); listener.connectionOccured(new ConnectionEvent(host)); } } public void addConnectionListener(ConnectionListener listener) { System.out.println(listener.toString()); this.listener = listener; } }