@Override public void actionPerformed(ActionEvent e) { receive.setEnabled(false); input.setEnabled(false); output.setEnabled(false); clientFrame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); ClientMain.lock.lock(); try { ClientMain.notifyUserInputed(); while (fileReceiver == null) { try { ClientMain.fileReceiverNotInitialized.await(); if (ClientMain.hasErrorOccurred()) { unregisterFileReceiver(); return; } } catch (InterruptedException e1) { } } fileReceiver.addPropertyChangeListener(this); fileReceiver.execute(); } finally { ClientMain.setErrorOccurred(false); ClientMain.lock.unlock(); } }
@Override public void run() { try { msg = dis.readUTF(); System.out.println("메세지 받음"); System.out.println(msg); if (msg.equals("using")) { cMain.loginFrame.UsingMessage(); return; } else { } while (dis != null) { msg = dis.readUTF(); System.out.println(msg); if (msg.equals("stopCom")) { dao_User.UserStop(seatNum); cMain.usingFrame.user.setRun(false); cMain.ShowLogin(cMain.usingFrame); return; } else { chat.receiveMsg(msg); } System.out.println(msg); // cGui.receiveMsg(msg); } } catch (IOException e) { e.printStackTrace(); } // catch(ClassNotFoundException ce){ce.printStackTrace();} }
@Override public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new java.io.File(".")); chooser.setDialogTitle("Please choose a output directory"); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setAcceptAllFileFilterUsed(false); if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { ClientMain.updateOutputDirectory(chooser.getSelectedFile().getAbsolutePath()); } }
@Test public void clientMainTest() throws Exception { String[] args = {"Client", "-s", "test"}; ClientMain.main(args); }