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(); } } }
@Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub if (e.getSource().equals(b2)) { f.dispose(); } else if (e.getSource().equals(b1)) { f.dispose(); new fenetre(); } }
// {{{ dispose() method @Override public void dispose() { instance = null; EditBus.removeFromBus(this); EditBus.removeFromBus(installer); super.dispose(); } // }}}
@Override public void dispose() { saveLocation(getBounds()); super.dispose(); Disposer.dispose(myScreen); WelcomeFrame.resetInstance(); }
// --------------------------------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(); }
/** * Logs the teacher in if they have previously registered for a new account * * @param u String username * @param p char password */ public void logInTeacher(String u, String p) { username = u; String pWord = p; if (dataBase.login(u, pWord)) { TeacherView t = new TeacherView(dataBase, u); screen.dispose(); } }
public void actionPerformed(ActionEvent e) { if (e.getSource() == (Object) (quit)) { frame.dispose(); } else if (e.getSource() == (Object) (confirm)) { ArrayList<File> rFiles = new ArrayList<File>(); for (int i = 0; i < boxes.size(); i++) { if (boxes.get(i).isSelected()) { rFiles.add(getFile(boxes.get(i).getActionCommand())); } } try { DriveRemove.remove(rFiles); } catch (IOException ex) { System.out.println("error removing"); } frame.dispose(); } }
public void quit() { super.quit(); display = null; if (displayFrame != null) { JFrame f = displayFrame; displayFrame = null; f.dispose(); } }
public void dispose() { f.dispose(); f = null; dummy.dispose(); dummy = null; if (modal_d != null) { modal_d.dispose(); modal_d = null; } }
/** 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(); }
public void dispose() { super.dispose(); if (mViewport != null) { mViewport.terminate(); mViewport = null; } setUniverse(null); if (mBackBufferGfx != null) { mBackBufferGfx.dispose(); } Logger.log("FramedViewportContainer terminated"); }
public void actionPerformed(ActionEvent e) { String s = new String(e.getActionCommand()); if ((s).equals("Login")) { try { if (factory.authenticate(username.getText(), password.getText())) { loginFrame.dispose(); new HomeScreen(factory); } else { JOptionPane.showMessageDialog(loginFrame, "Username or Password is incorrect."); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } else if ((s).equals("Cancel")) { loginFrame.dispose(); new ExitListener(); } }
public void actionPerformed(ActionEvent e) { if (to == e.getSource()) { toSendWindow(); // Display list for user selection // puts user selection into JTextField to } else if (addContacts == e.getSource()) { addContactWindow(); // Display prompt for information for new contact // Uses information to add to ContactList collection // } else if (removeContacts == e.getSource()) { removeContactWindow(); // Display prompt for removing contacts // Uses information to remove from ContactList collection } else if (editContacts == e.getSource()) { editContactWindow(); // UI for editing contacts } else if (save == e.getSource()) { cList.addContact( new Contact( newContactFields[0].getText(), newContactFields[1].getText(), newContactFields[2].getText())); JOptionPane.showMessageDialog( null, "The contact has been added.", "Success!", JOptionPane.INFORMATION_MESSAGE); addWindow.dispose(); } else if (deleteContact == e.getSource()) { ContactList cDeleted = contactList.getContacts(); for (int i = 0; i < cDeleted.getLength(); i++) { cList.removeContact(cDeleted.getContact(i)); /* PLACEHOLDER FOR REPAINT */ } removeWindow.dispose(); } else if (addSendContacts == e.getSource()) { toText.setText(toText.getText() + contactList.getEmails()); toWindow.dispose(); } }
public void windowClosing(WindowEvent ev) { try { cConn.close(); } catch (Exception e) { } fMain.dispose(); if (bMustExit) { System.exit(0); } }
public void actionPerformed(ActionEvent e) { System.out.println(e.getActionCommand()); if (e.getActionCommand().equals("Login")) { String serverIp = jfIp.getText(); if (!CommonUtils.checkIsCorrectIp(serverIp)) { JOptionPane.showMessageDialog(null, "Ip Format is incorrect"); return; } if (isPasswordCorrect(jfName.getText().trim(), jfPwd.getText().trim())) { String oo = Jclass.getSelectedItem().toString(); jlTips.setText("input Correct"); System.out.println("Correct"); // new ChatClient(defaultport); // two class plugins. gui and konsole.. // gui ---TemplateChatClient // konsole---ChatConsole try { if (oo.equals("GUI")) { CommonUtils.PrintMe("用户选择了Gui界面"); new TemplateChatClient(defaultport, serverIp); } else if (oo.equals("Konsole")) { new TemplateChatConsole(defaultport, serverIp); } } catch (Exception ex) { System.out.println("Initialization failed!!"); return; } // // cf.setVisible(true); fLogin.setVisible(false); fLogin.dispose(); } else { jlTips.setText("Username or Password is not correct."); System.out.println("False Retry!"); jfPwd.selectAll(); } } else { System.exit(0); } }
/** * Este método sirve para verificar la partida del jugador y mostrar un mensaje de confirmación. */ private void partidaTerminada() { verificarPartida(); // este metodo comprueba si la partida actual del jugador es mejor que las // anteriores. String opcion; do { opcion = JOptionPane.showInputDialog( "¡Partida Finalizada!\nIngrese 1 para volver a iniciar una partida.\nIngrese 2 para ir al menú principal."); } while (opcion == null || !opcion.equals("1") && !opcion.equals("2")); switch (opcion) { case "1": // en caso de que sea uno se resetea todo el juego. resetearJuego(); break; case "2": // en caso de que sea dos se regresa al menú principal. ventana.dispose(); MainInterface main = new MainInterface(jugadores); main.setVisible(true); break; } }
public void actionPerformed(ActionEvent ae) { if (ae.getSource() == b) { PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(this); boolean ok = job.printDialog(); if (ok) { try { job.print(); } catch (PrinterException pe) { System.out.println(pe); pe.printStackTrace(); } } } if (ae.getSource() == back) { new remindersub(); f.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); } }
public ShowResults(SharkPanel _sp, String _files[], double _scores[], int _nrpairs[]) { sp = _sp; files = _files; scores = _scores; nrpairs = _nrpairs; LogFile lf = new LogFile("SearchResults_"); DefaultListModel listModel = new DefaultListModel(); for (int i = 0; i < files.length; i++) { GetImageFile gif = new GetImageFile(files[i]); Integer ii = new Integer(_nrpairs[i]); int tmpval = (int) (1000.0 * _scores[i]); Double dd = new Double((double) tmpval / 1000.0); String tmp = gif.getImageString(); String s = tmp.substring(tmp.lastIndexOf('\\') + 1, tmp.length()) + "\t" + ii.toString() + "\t" + dd.toString(); String ddval = dd.toString(); while (ddval.length() < 5) ddval += "0"; if (i < 9) listModel.addElement( " " + (i + 1) + ". " + ddval + " " + tmp.substring(tmp.lastIndexOf('\\') + 1, tmp.length())); else listModel.addElement( (i + 1) + ". " + ddval + " " + tmp.substring(tmp.lastIndexOf('\\') + 1, tmp.length())); lf.write(s); } lf.close(); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); list = new JList(listModel); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setDragEnabled(false); list.addMouseListener(new MouseClickListener()); JScrollPane listView = new JScrollPane(list); listView.setPreferredSize(new Dimension(250, 250)); showButton = new JButton("Visual comparison"); showButton.addActionListener(this); showButton.setMnemonic('V'); showButton.setEnabled(false); JButton closeButton = new JButton("Close"); closeButton.addActionListener(this); closeButton.setMnemonic('C'); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); panel.add(listView, BorderLayout.CENTER); panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel panel2 = new JPanel(); panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS)); panel2.add(showButton); panel2.add(Box.createRigidArea(new Dimension(10, 1))); panel2.add(closeButton); add(panel); add(Box.createRigidArea(new Dimension(1, 10))); add(panel2); if (frame != null) frame.dispose(); frame = new JFrame("I3S: Search results"); frame.setContentPane(this); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { frame.dispose(); frame = null; } }); frame.setSize(new Dimension(400, 300)); frame.setLocation(200, 200); ImageIcon imageIcon = new ImageIcon(this.getClass().getResource("/Simages/icon.gif")); frame.setIconImage(imageIcon.getImage()); frame.pack(); frame.setVisible(true); }
@Override public void dispose() { super.dispose(); if (VncViewer.osEID()) cleanupExtInputHelper(); }
public void actionPerformed(ActionEvent ae) { String s1 = ae.getActionCommand(); if (s1.equals("Calendar")) { // DatePicker dp=new DatePicker(f); // dp.displayDate(); // f.getContentPane().add(p); b3.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { t6.setText(new DatePicker(f).setPickedDate()); } }); } else if (s1.equals("LogOut")) { f.dispose(); start p = new start(); p.method(); } else if (s1.equals("Search")) { try { String data = t1.getSelectedItem(); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:raman1"); Statement stm = con.createStatement(); ResultSet rs = stm.executeQuery("select * from mprofile where Manager_Id='" + data + "' "); while (rs.next()) { String a2 = rs.getString(1); t2.setText(a2); String a3 = rs.getString(2); t3.setText(a3); String a4 = rs.getString(3); t4.setText(a4); String a5 = rs.getString(4); t5.setText(a5); String a6 = rs.getString(6); t6.setText(a6); String a7 = rs.getString(7); t7.setText(a7); String a8 = rs.getString(8); t8.setText(a8); String a9 = rs.getString(9); t9.setText(a9); String a10 = rs.getString(10); t10.setText(a10); p.add(l3); p.add(t2); p.add(l4); p.add(t3); p.add(l5); p.add(t4); p.add(l6); p.add(t5); p.add(l7); p.add(c1); p.add(c2); p.add(l8); p.add(t6); p.add(l9); p.add(t7); p.add(l10); p.add(t8); p.add(l11); p.add(t9); p.add(l12); p.add(t10); p.add(b2); p.add(b3); p.add(b4); } } catch (Exception e) { } } else if (s1.equals("Update")) { String y2 = t2.getText(); String y3 = t3.getText(); String update_id = t4.getText(); String y4 = t5.getText(); String y6 = t6.getText(); String y7 = t7.getText(); String y8 = t8.getText(); String y9 = t9.getText(); String y10 = t10.getText(); try { String y = t1.getSelectedItem(); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:raman1"); PreparedStatement ps = con.prepareStatement( "update mprofile set Location=? , E_Mail_Id=? ,Contact_No =?, Address=?, D_O_B=?,Gender=?, Password=?, Manager_Id=?,manager_father=?,manager_name=? where Manager_Id='" + y + "' "); ps.setString(1, y10); ps.setString(2, y9); ps.setString(3, y8); ps.setString(4, y7); ps.setString(5, y6); ps.setString(6, g); ps.setString(7, y4); ps.setString(8, update_id); ps.setString(9, y3); ps.setString(10, y2); ps.executeUpdate(); JOptionPane.showMessageDialog(p, "data has been updated"); f.dispose(); project p = new project(); p.method(); } catch (Exception e) { System.out.println(e); } } else if (s1.equals("Close")) { f.dispose(); } else { f.dispose(); project p = new project(); p.method(); } }
@Override public void dispose() { setAppIconExecutor.shutdownNow(); super.dispose(); }
/** Close the window after an OK or Cancel. */ protected void disposeFrame() { dialog.dispose(); editor = null; }
public void windowClosing(WindowEvent evt) { JFrame frame = (JFrame) evt.getSource(); frame.setVisible(false); frame.dispose(); }
public void dispose() { super.dispose(); DatanGraphics.frames.setElementAt(null, index); }
public void dispose() { if (frame != null) frame.dispose(); frame = null; }
// Action - vad som händer om man klickar på de olika knapparna public void actionPerformed(ActionEvent e) { // Om man trycker på startknappen if (e.getSource() == go) { for (int i = 0; i < 4; i++) { // Skapar spelare och AI, beroende på om textfälten och checkboxarna är ifyllda if (textfields.get(i).getText().length() > 0) { // Om checkboxen är itryckt, skapa ett AI if (boxes.get(i).isSelected()) { try { if (Integer.parseInt(intfields.get(i).getText()) >= 0) { players.add( new AI( textfields.get(i).getText(), Integer.parseInt(intfields.get(i).getText()))); } // Om intellegensen är angivet negativt använder vi ett minne av storleken 0. else { players.add(new AI(textfields.get(i).getText(), 0)); } } // Om intellegensen inte är angiven i siffror, använd standardintellegensen på 20 korts // minne catch (NumberFormatException ex) { players.add(new AI(textfields.get(i).getText(), 20)); } } // Om spelaren inte är ett AI, lägg till en vanlig spelare else { players.add(new Player(textfields.get(i).getText())); } } } // Stänger ner menyn och startar spelet, skickar med spelarinfon if (players.size() >= 1) { this.dispose(); f.dispose(); new Memory(players); } } // Om man trycker på hjälpknappen visas en ruta med lite instruktioner if (e.getSource() == help) { f.setVisible(true); f.setBounds(300, 200, 500, 200); f.setResizable(false); String text = "<html>Om inställningar:<br>Skriv in spelarnas namn för att lägga till dem.<br>" + "Om AI önskas: Klicka i rutan och ange intellegens. (Antal kort AIn kommer ihåg.)<br>" + "Tryck på 'Starta' för att starta spelet.<br><br>" + "Hur man spelar:<br>Spelaren vars tur det är får sitt namn markerat med grön färg längst ner.<br>" + "För att göra ditt drag, tryck på korten. Du kan inte välja samma kort två gånger<br><br>" + "Det är ett vanligt memory, lets go!</html>"; f.add(new JLabel(text), BorderLayout.NORTH); } for (int i = 0; i < boxes.size(); i++) { // Om checkboxarna är ikryssade lägger den till ett eget namn för AIn som ska skapas och visar // rutan för intellegensbestämning if (boxes.get(i).isSelected()) { textfields.get(i).setText("AI " + (i + 1)); textfields.get(i).setEnabled(false); intfields.get(i).setText("" + 20); intfields.get(i).setVisible(true); } // Om checkboxarna blir urklickade igen, nollställ textfälten, och ta bort rutan för // intellegensbestämning else if (!boxes.get(i).isSelected()) { if (textfields.get(i).getText().indexOf("AI") != -1) { textfields.get(i).setText(""); intfields.get(i).setVisible(false); } textfields.get(i).setEnabled(true); } } }