Esempio n. 1
1
 public void run(String local, String remote, InputStream pin, OutputStream pout) {
   try {
     microphone = SoundMixerEnumerator.getInputLine(pcmformat, DefaultPhonePCMBlockSize);
   } catch (LineUnavailableException lue) {
     System.out.println(
         "\3b"
             + getClass().getName()
             + ".<init>:\n\tCould not create microphone input stream.\n\t"
             + lue);
   }
   try {
     speaker = SoundMixerEnumerator.getOutputLine(pcmformat, DefaultPhonePCMBlockSize);
   } catch (LineUnavailableException lue) {
     microphone.close();
     System.out.println(
         "\3b"
             + getClass().getName()
             + ".<init>:\n\tCould not create speaker output stream.\n\t"
             + lue);
   }
   if ((speaker == null) || (microphone == null)) {
     super.run(local, remote, pin, pout);
     return;
   }
   try {
     recorder = new Recorder(pout);
     recorder.start();
     gui = openMonitorGUI("Remote " + remote + " Local " + local);
     pin.skip(pin.available()); // waste whatever we couldn't process in time
     super.run(local, remote, new PhoneCallMonitorInputStream(pin), pout);
     recorder.interrupt();
     gui.dispose();
   } catch (Exception e) {
     System.out.println("3\b" + getClass().getName() + ".run:\n\t" + e);
     e.printStackTrace();
   } finally {
     deactivate();
     microphone.close();
     speaker.close();
     if (gui != null) {
       gui.dispose();
     }
   }
 }
Esempio n. 2
0
  // --------------------------------actionQuit---------------------------------
  private void actionQuit() {
    int nResult =
        JOptionPane.showConfirmDialog(
            frame, "Are you sure you wish to quit?", "Are you sure?", JOptionPane.YES_NO_OPTION);

    if (nResult == JOptionPane.YES_OPTION) frame.dispose();
  }
Esempio n. 3
0
 public void stop() {
   running = false;
   for (Handler handler : logger.getHandlers()) {
     handler.flush();
     handler.close();
   }
   if (jFrame != null) {
     jFrame.dispose();
   }
 }
Esempio n. 4
0
 public void dispose() {
   f.dispose();
   f = null;
   dummy.dispose();
   dummy = null;
   if (modal_d != null) {
     modal_d.dispose();
     modal_d = null;
   }
 }
Esempio n. 5
0
 /** Leave Group and close JWhiteBoard */
 public void stop() {
   if (!noChannel) {
     try {
       channel.close();
     } catch (Exception ex) {
       System.err.println(ex);
     }
   }
   mainFrame.setVisible(false);
   mainFrame.dispose();
 }
  /**
   * run will be exicuted when the thread is called, and will connect to the server and start
   * communicating with it.
   */
  public void run() {
    WaitForConnection wfc = new WaitForConnection("Waiting For Connection");
    m_OldWindow.setEnabled(false);
    try {
      m_Socket = new Socket(m_IP, m_Port);

      // System.out.println("Connecting to ChatService...");
      m_ChatSocket = new Socket(m_IP, m_Port);
      // System.out.println("\nConnected to ChatService...");

      wfc.updateMessage("Waiting For Other Players");

      // System.out.println("Getting OutputStream Stream From server...");
      toServer = new ObjectOutputStream(m_Socket.getOutputStream());
      toChatServer = new ObjectOutputStream(m_ChatSocket.getOutputStream());
      toChatServer.flush();

      // System.out.println("Getting Input Stream From server...");
      fromServer = new ObjectInputStream(m_Socket.getInputStream());
      fromChatServer = new ObjectInputStream(m_ChatSocket.getInputStream());

      m_ChatService = new ChatService();
      m_ChatServiceThread = new Thread(m_ChatService);
      m_ChatServiceThread.start();

      m_MultiPlayerMenu.startGame();
      wfc.dispose();
      m_OldWindow.dispose();
    } catch (java.net.ConnectException e) {
      wfc.dispose();
      MenuWindow menu = new MenuWindow(new JFrame(""));
      JOptionPane.showMessageDialog(menu.getMainFrame(), "Error Connection refused");
      m_OldWindow.setEnabled(true);
    } catch (IOException ex) {
      System.err.print(ex);
    }
  }
Esempio n. 7
0
 public void setupMainMenuFrame(JFrame currentFrame) {
   currentFrame.dispose();
   mainMenuScreen = new Main_Menu();
   mainMenuScreen.setVisible(true);
 }
Esempio n. 8
0
 public void setupDualScreenFrame(JFrame currentFrame) {
   currentFrame.dispose();
   dualScreen = new DualScreen();
   dualScreen.setVisible(true);
 }
Esempio n. 9
0
 public void setupBrowseDeckScreenFrame(JFrame currentFrame) {
   currentFrame.dispose();
   browseDeckScreen = new BrowseDeckScreen();
   browseDeckScreen.setVisible(true);
 }
Esempio n. 10
0
 public void setupShopScreenFrame(JFrame currentFrame) {
   currentFrame.dispose();
   shopScreen = new ShopScreen();
   shopScreen.setVisible(true);
 }
Esempio n. 11
0
 // Call these when ever you need open a new window
 public void setupPlayerMenuScreenFrame(JFrame currentFrame) {
   currentFrame.dispose();
   playerMenuScreen = new PlayerMenuScreen();
   playerMenuScreen.setVisible(true);
 }
Esempio n. 12
0
 @Override
 public void dispose() {
   super.dispose();
   if (VncViewer.osEID()) cleanupExtInputHelper();
 }
Esempio n. 13
0
 public void windowClosing(WindowEvent evt) {
   JFrame frame = (JFrame) evt.getSource();
   frame.setVisible(false);
   frame.dispose();
 }