목차
▲ Term Project의 기본적인 개요
▲ 제작 환경
▲ Term Project의 레고 조립 부분의 세부적인 부분
▲ 기본적인 Program Code 분석
▲ 결 론
▲ 제작 환경
▲ Term Project의 레고 조립 부분의 세부적인 부분
▲ 기본적인 Program Code 분석
▲ 결 론
본문내용
간 입력 : \");
soap = JOptionPane.showInputDialog(null, \"비눗물을 뿌리는 시간 입력 : \");
JOptionPane.showMessageDialog(null, \"종료하기 위해선 Ctrl+c를 입력 !!!!!!\");
// 입력 받은 스트림을 차례대로 소켓을 통해서 보낸다.
os.println(\"1\");
os.flush();
os.println(time1);
os.flush();
os.println(water1);
os.flush();
os.println(soap);
os.flush();
*/
// 해당 과정에 따라서 색을 변경시킬려고 했지만 이 기능은 생략함
try{
thread1.sleep(5);
button_start.setForeground(Color.black);
button_water.setForeground(Color.red);
thread1.sleep(3);
button_water.setForeground(Color.black);
button_wash.setForeground(Color.red);
thread1.sleep(5);
button_wash.setForeground(Color.black);
button_rail.setForeground(Color.red);
thread1.sleep(5);
button_rail.setForeground(Color.black);
}catch(InterruptedException iex){}*/
}
}
);
stop = new JButton(\"Push to stop\");
stop.addActionListener( // STOP 버튼이 눌리어졌을 경우에 이벤트 핸들링
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
//JOptionPane.showMessageDialog(null, \" 전체 시스템을 종료 합니다.\");
os.println(\"2\");
os.flush();
disconnect();
stop();
//os.println(\"2\");
//os.flush();
}
}
);
boxes[7].add(start);
boxes[7].add(Box.createHorizontalStrut(20));
boxes[7].add(stop);
addComponent(boxes[7],23,0,8, 4);
}
// GridBag layout을 이용하기 위한 함수(각 component의 위치를 확인)
void addComponent(Component component, int row, int column, int width, int height)
{
constraints.gridx = column;
constraints.gridy = row;
constraints.gridwidth = width;
constraints.gridheight = height;
layout.setConstraints(component, constraints);
container.add(component);
}
public void runClient()
{
try
{
connectToServer();
getStream();
processConnection();
closeConnection();
}
catch(EOFException eofException)
{}
catch(IOException ioException)
{}
}
public void getStream() throws IOException
{
output = new ObjectOutputStream(client.getOutputStream());
output.flush();
input = new ObjectInputStream(client.getInputStream());
//displayArea.append(\"\\n Got I/O streams\\n\");
}
public void connectToServer() throws IOException
{
displayArea.setText(\"Attempting connection \\n\");
client = new Socket(InetAddress.getByName(chatServer), 5678);
//displayArea.append
}
public void processConnection() throws IOException
{
do
{
try
{
message = (String) input.readObject();
}
catch(ClassNotFoundException classNotFoundException){}
}while(!message.equals(\"TERMINATE\"));
}
public void closeConnection() throws IOException
{
displayArea.setText(\"Closing connection\");
output.close();
input.close();
client.close();
}
protected void connect()
{
try{
socket1=new Socket(\"155.230.17.135\",5678); // 소켓을 초기화 시켜 준다.
//bis = new BufferedInputStream(socket1.getInputStream());
//bos = new BufferedOutputStream(socket1.getOutputStream());
is=new BufferedReader(new InputStreamReader(socket1.getInputStream()));
os=new PrintWriter(new OutputStreamWriter
(socket1.getOutputStream()),true);
os.println(\"0\");
//bos.write(, 0, 3);
displayArea.setText(\"Connectioin Ok\");
//BufferedOutputStream
} catch(IOException ex) {
displayArea.setText(\"Socket Open Error\");
}
}
public void disconnect() // 소켓의 연결을 끊을
soap = JOptionPane.showInputDialog(null, \"비눗물을 뿌리는 시간 입력 : \");
JOptionPane.showMessageDialog(null, \"종료하기 위해선 Ctrl+c를 입력 !!!!!!\");
// 입력 받은 스트림을 차례대로 소켓을 통해서 보낸다.
os.println(\"1\");
os.flush();
os.println(time1);
os.flush();
os.println(water1);
os.flush();
os.println(soap);
os.flush();
*/
// 해당 과정에 따라서 색을 변경시킬려고 했지만 이 기능은 생략함
try{
thread1.sleep(5);
button_start.setForeground(Color.black);
button_water.setForeground(Color.red);
thread1.sleep(3);
button_water.setForeground(Color.black);
button_wash.setForeground(Color.red);
thread1.sleep(5);
button_wash.setForeground(Color.black);
button_rail.setForeground(Color.red);
thread1.sleep(5);
button_rail.setForeground(Color.black);
}catch(InterruptedException iex){}*/
}
}
);
stop = new JButton(\"Push to stop\");
stop.addActionListener( // STOP 버튼이 눌리어졌을 경우에 이벤트 핸들링
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
//JOptionPane.showMessageDialog(null, \" 전체 시스템을 종료 합니다.\");
os.println(\"2\");
os.flush();
disconnect();
stop();
//os.println(\"2\");
//os.flush();
}
}
);
boxes[7].add(start);
boxes[7].add(Box.createHorizontalStrut(20));
boxes[7].add(stop);
addComponent(boxes[7],23,0,8, 4);
}
// GridBag layout을 이용하기 위한 함수(각 component의 위치를 확인)
void addComponent(Component component, int row, int column, int width, int height)
{
constraints.gridx = column;
constraints.gridy = row;
constraints.gridwidth = width;
constraints.gridheight = height;
layout.setConstraints(component, constraints);
container.add(component);
}
public void runClient()
{
try
{
connectToServer();
getStream();
processConnection();
closeConnection();
}
catch(EOFException eofException)
{}
catch(IOException ioException)
{}
}
public void getStream() throws IOException
{
output = new ObjectOutputStream(client.getOutputStream());
output.flush();
input = new ObjectInputStream(client.getInputStream());
//displayArea.append(\"\\n Got I/O streams\\n\");
}
public void connectToServer() throws IOException
{
displayArea.setText(\"Attempting connection \\n\");
client = new Socket(InetAddress.getByName(chatServer), 5678);
//displayArea.append
}
public void processConnection() throws IOException
{
do
{
try
{
message = (String) input.readObject();
}
catch(ClassNotFoundException classNotFoundException){}
}while(!message.equals(\"TERMINATE\"));
}
public void closeConnection() throws IOException
{
displayArea.setText(\"Closing connection\");
output.close();
input.close();
client.close();
}
protected void connect()
{
try{
socket1=new Socket(\"155.230.17.135\",5678); // 소켓을 초기화 시켜 준다.
//bis = new BufferedInputStream(socket1.getInputStream());
//bos = new BufferedOutputStream(socket1.getOutputStream());
is=new BufferedReader(new InputStreamReader(socket1.getInputStream()));
os=new PrintWriter(new OutputStreamWriter
(socket1.getOutputStream()),true);
os.println(\"0\");
//bos.write(, 0, 3);
displayArea.setText(\"Connectioin Ok\");
//BufferedOutputStream
} catch(IOException ex) {
displayArea.setText(\"Socket Open Error\");
}
}
public void disconnect() // 소켓의 연결을 끊을
소개글