실습 채팅 ClientFrame

학교/엔터프라이즈 2013. 4. 18. 17:59

import java.net.*;
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class ClientFrame extends JFrame implements ActionListener{
 private JTextArea display;
 private JTextField inputFiled;
 private JButton sendButton;
 private JScrollPane topPane;
 private JPanel bottomPanel;
 
 private BufferedReader input;
 private PrintWriter output;
 private String name;
 public ClientFrame()
 {
  display =new JTextArea(5,15);
  display.setEditable(false); //키보드로  마음데로 입력 못함
  
  inputFiled =new JTextField(15);
  inputFiled.addActionListener(this);
  sendButton=new JButton("Send");
  sendButton.addActionListener(this);
  
  topPane =new JScrollPane(display);
  bottomPanel=new JPanel();
  bottomPanel.setLayout(new FlowLayout());
  bottomPanel.add(inputFiled);
  bottomPanel.add(sendButton);
  this.setLayout(new BorderLayout());
  this.add(topPane,"Center");
  this.add(bottomPanel,"South");
  
  this.setSize(300,400);
  this.setTitle("클라이언트");
  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  this.setVisible(true);
 }
 public static void main(String [] ar)
 {
  new ClientFrame();
 }
 @Override
 public void actionPerformed(ActionEvent e) {
  // TODO Auto-generated method stub
  
 }
}

'학교 > 엔터프라이즈' 카테고리의 다른 글

엔터프라이즈 실습4  (0) 2013.03.28
엔터프라이즈 실습3  (0) 2013.03.27
엔터 프라이즈  (0) 2013.03.22
엔터프라이즈  (0) 2013.03.06