Esempio n. 1
0
  public File soundDialog(JFrame frame, boolean train) {
    Object[] options = {"Kinect", "Record", "Select"};
    int n =
        JOptionPane.showOptionDialog(
            frame,
            "Record via kinect, microphone or select a .wav?",
            "Sound Source Selection",
            JOptionPane.YES_NO_CANCEL_OPTION,
            JOptionPane.QUESTION_MESSAGE,
            null,
            options,
            options[0]);
    File file = null;
    if (n == 2) {
      JFileChooser fc = new JFileChooser();
      int returnVal = fc.showOpenDialog(frame);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        file = fc.getSelectedFile();
      }
    } else if (n == 0) {
      SoundPreparer sp = new SoundPreparer();
      JDialog dlg = this.showActivityBar("Recording Audio", frame);
      file = sp.recordKinect(train);
      dlg.dispose();
    } else if (n == 1) {
      SoundPreparer sp = new SoundPreparer();
      JDialog dlg = this.showActivityBar("Recording Audio", frame);
      file = sp.record(train);
      dlg.dispose();
    } else {

    }
    return file;
  }
 /** Listener to handle button actions */
 public void actionPerformed(ActionEvent e) {
   // Check if the user pressed the ok button
   if (e.getSource() == ok_button) {
     filter_include_list = include_panel.getServiceList();
     filter_exclude_list = exclude_panel.getServiceList();
     if (status_box.isSelected()) {
       filter_active = status_active.isSelected();
       filter_complete = status_complete.isSelected();
     } else {
       filter_active = false;
       filter_complete = false;
     }
     ok_pressed = true;
     dialog.dispose();
   }
   // Check if the user pressed the cancel button
   if (e.getSource() == cancel_button) {
     dialog.dispose();
   }
   // Check if the user changed the status filter option
   if (e.getSource() == status_box) {
     status_active.setEnabled(status_box.isSelected());
     status_complete.setEnabled(status_box.isSelected());
   }
 }
 public void hideDialog(JDialog dialog, Project project) {
   if (project == null) {
     dialog.dispose();
   } else {
     IdeFrameImpl frame = getFrame(project);
     if (frame.isActive()) {
       dialog.dispose();
     } else {
       queueForDisposal(dialog, project);
       dialog.setVisible(false);
     }
   }
 }
  public void carregarAcoes() {

    check0_001.addActionListener(
        actionEvent -> {
          String codigo = Parametro.CARREGAR_RDF_GERADO;
          String valor = String.valueOf(check0_001.isSelected());
          configuracoes.put(codigo, valor);
        });

    check0_003.addActionListener(
        actionEvent -> {
          String codigo = Parametro.VALIDAR_TODOS_METADADOS;
          String valor = String.valueOf(check0_003.isSelected());
          configuracoes.put(codigo, valor);
        });

    check0_005.addActionListener(
        actionEvent -> {
          String codigo = Parametro.PERGUNTAR_SINTAXE_RDF;
          item1.setEnabled(check0_005.isSelected());
          item2.setEnabled(check0_005.isSelected());

          String valor = String.valueOf(check0_005.isSelected());
          configuracoes.put(codigo, valor);
        });

    final JDialog dialogo = this;

    // Irá aplicar as configurações e sair
    botaoOk.addActionListener(
        actionEvent -> {
          try {
            SenseUtil.validarEndereco(caixa0_004.getText());
          } catch (SenseRDFException se) {
            JOptionPane.showMessageDialog(
                null, se.getMessage(), Sap.ERRO.get(), JOptionPane.ERROR_MESSAGE);
            return;
          }

          aplicarConfiguracoes = true;
          aplicarConfiguracoes();
          dialogo.dispose();
        });

    // Ao clicar em cancelar não se deve fazer nada
    botaoCancelar.addActionListener(
        actionEvent -> {
          aplicarConfiguracoes = false;
          dialogo.dispose();
        });
  }
Esempio n. 5
0
 /**
  * Pops up a "Tip of the day" dialog.
  *
  * <p>If <code>choice</code> is not null, the method first checks if <code>force</code> is true or
  * if {@link ShowOnStartupChoice#isShowingOnStartup()} is true before showing the dialog.
  *
  * <p>Additionally, it saves the state of the "Show tips on startup" checkbox using the given
  * {@link ShowOnStartupChoice} object.
  *
  * @param parentComponent
  * @param choice
  * @param force if true, the dialog is displayed even if {@link
  *     ShowOnStartupChoice#isShowingOnStartup()} is false
  * @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true.
  * @see java.awt.GraphicsEnvironment#isHeadless
  * @return true if the user chooses to see the tips again, false otherwise.
  */
 public boolean showDialog(Component parentComponent, ShowOnStartupChoice choice, boolean force) {
   if (choice == null) {
     JDialog dialog = createDialog(parentComponent, choice);
     dialog.setVisible(true);
     dialog.dispose();
     return true;
   } else if (force || choice.isShowingOnStartup()) {
     JDialog dialog = createDialog(parentComponent, choice);
     dialog.setVisible(true);
     dialog.dispose();
     return choice.isShowingOnStartup();
   } else {
     return false;
   }
 }
 @Override
 public void dispose() {
   super.dispose();
   if (webCam != null) {
     webCam.stop();
   }
 }
Esempio n. 7
0
 @Override
 public void dispose() {
   super.dispose();
   selectedFeatureId = null;
   selectedSampleId = null;
   results = null;
 }
  public void cadastrarPessoa() {
    Statement statement = Conexao.conectar();
    if ((fieldNome.getText() != null && !fieldNome.getText().equals(""))
        && (fieldRG.getText() != null && !fieldRG.getText().equals(""))) {
      String sql =
          "insert into dbe_paciente(nome, rg) values('"
              + fieldNome.getText()
              + "', '"
              + fieldRG.getText()
              + "');";

      try {
        statement.executeUpdate(sql);
        JOptionPane.showMessageDialog(
            null,
            "Paciente Cadastrado com Sucesso!!! ",
            "Sucesso",
            JOptionPane.INFORMATION_MESSAGE);
        Conexao.desconectar(statement.getConnection());
        statement.close();
        janela.dispose();
      } catch (SQLException ex) {
        // TODO Auto-generated catch block
        ex.printStackTrace();
      }
    } else {
      JOptionPane.showMessageDialog(
          null, "Preencha Nome e RG", "Erro", JOptionPane.WARNING_MESSAGE);
    }
  }
Esempio n. 9
0
 /** Dispose of the dialog */
 protected void dispose() {
   displayControl = null;
   if (dialog != null) {
     dialog.dispose();
     dialog = null;
   }
 }
Esempio n. 10
0
 private void cancelButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_cancelButtonActionPerformed
   // TODO add your handling code here:
   cancel = true;
   dialog.setVisible(false);
   dialog.dispose();
 } // GEN-LAST:event_cancelButtonActionPerformed
  @Override
  public void actionPerformed(ActionEvent arg0) {
    try {

      URL url = new URL(excelUrl);
      HttpURLConnection connection = (HttpURLConnection) url.openConnection();
      int filesize = connection.getContentLength();
      float totalDataRead = 0;
      java.io.BufferedInputStream in = new java.io.BufferedInputStream(connection.getInputStream());
      java.io.FileOutputStream fos = new java.io.FileOutputStream(excelName);
      java.io.BufferedOutputStream bout = new BufferedOutputStream(fos, 14921);
      byte[] data = new byte[14921];
      int i = 0;
      JOptionPane jop2 = new JOptionPane("VitalHealth Test Automation Framework");
      JDialog k2 = jop2.createDialog("Please wait till file is downloaded");
      k2.setModal(false);
      k2.setVisible(true);

      while ((i = in.read(data, 0, 14921)) >= 0) {
        totalDataRead = totalDataRead + i;
        bout.write(data, 0, i);
        float Percent = (totalDataRead * 100) / filesize;
      }
      bout.close();
      in.close();
      // fos.close();
      k2.dispose();

    } catch (Exception e) {
      JOptionPane.showMessageDialog(null, "Sample Configuration file downloaded");
    }
  }
Esempio n. 12
0
 /** Dispose. */
 public void dispose() {
   if (prgTimer != null) {
     prgTimer.cancel();
   }
   progressBar.setValue(100);
   dialog.dispose();
 }
Esempio n. 13
0
  public static char[] showPasswordDialog(Component parent, String titre) {
    final JPasswordField jpf = new JPasswordField();
    JOptionPane jop =
        new JOptionPane(jpf, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
    // FIXME: label
    JDialog dialog = jop.createDialog(parent, titre);
    dialog.addComponentListener(
        new ComponentAdapter() {

          public void componentShown(ComponentEvent e) {
            jpf.requestFocusInWindow();
          }
        });
    dialog.setVisible(true);
    if (jop.getValue() == null) {
      return null;
    }
    int result = (Integer) jop.getValue();
    dialog.dispose();
    char[] password = null;
    if (result == JOptionPane.OK_OPTION) {
      password = jpf.getPassword();
    } else {
      return null;
    }
    return password;
  }
 @Override
 public void actionPerformed(ActionEvent AE) {
   if (TempControll.ConnectionManagerObject.createConnection())
     if (AE.getSource() == UpdateButton) {
       TempCourseTitle = CourseNameField.getText();
       TempCourseCredit = (String) CourseCreditBox.getSelectedItem();
       if (!TempCourseTitle.equals("")) {
         if (TempControll.DataEraseEditObject.editCourse(
             this.CourseNo, TempCourseTitle, TempCourseCredit))
           JOptionPane.showMessageDialog(
               DEPC,
               "Information of '" + this.CourseNo + "' has been updated successfully.",
               "Updated",
               JOptionPane.INFORMATION_MESSAGE);
         else
           JOptionPane.showMessageDialog(
               DEPC,
               "Information of '"
                   + this.CourseNo
                   + "' hasn't been updated.\nCheck if this course is still available & try again.",
               "Updated",
               JOptionPane.INFORMATION_MESSAGE);
         DEPC.dispose();
       } else
         JOptionPane.showMessageDialog(
             DEPC,
             "Please, complete 'Course Title'  field.",
             "Empty Course Title Field",
             JOptionPane.ERROR_MESSAGE);
     }
 }
 private void doModal(JDialog dlgParent) {
   m_dlgParent = dlgParent;
   m_dlgParent.setContentPane(this);
   m_dlgParent.pack();
   m_dlgParent.setLocationRelativeTo(null);
   m_dlgParent.setVisible(true);
   m_dlgParent.dispose();
 }
Esempio n. 16
0
  /** User wants to cancel the configuration */
  private void cancelAction() {

    // setVisible(false);   // doing both this and dispose() seems to cause problems in OpenJDK (the
    // setVisible(true) call never returns)

    myConfigManager.dialogConfigurationFinished(new ConfigDialogClosedException());
    super.dispose();
  }
 private void proceedDialogDisposalQueue(Project project) {
   Set<JDialog> dialogs = myDialogsToDispose.get(project);
   if (dialogs == null) return;
   for (JDialog dialog : dialogs) {
     dialog.dispose();
   }
   myDialogsToDispose.put(project, null);
 }
Esempio n. 18
0
 private void okButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_okButtonActionPerformed
   // TODO add your handling code here:
   cancel = false;
   JEnvironment.DEFAULT_REFLECT_AXIS = ((Number) angle.getValue()).doubleValue();
   dialog.setVisible(false);
   dialog.dispose();
 } // GEN-LAST:event_okButtonActionPerformed
Esempio n. 19
0
/*    */   public void dispose()
/*    */   {
/* 79 */     super.dispose();
/* 80 */     if ((!this.b) && (this.jdField_a_of_type_Boolean)) {
/* 81 */       System.err.println("Connection Dialog Terminated -> EXIT 0");
/* 82 */       System.exit(0);
/*    */     }
/*    */   }
  /** Tries to remove the color panel. If not found or not showing, does nothing. */
  private boolean removeColorPanel() {
    if (colorOverlay != null && colorOverlay.isShowing()) {
      colorOverlay.dispose();
      return true;
    }

    return false;
  }
Esempio n. 21
0
 public void closeWindow() {
   final OptionPanelWindowConfigurationStorage storage =
       new OptionPanelWindowConfigurationStorage();
   storage.setPanel(selectedPanel);
   storage.storeDialogPositions(topDialog, OptionPanel.PREFERENCE_STORAGE_PROPERTY);
   topDialog.setVisible(false);
   topDialog.dispose();
 }
  private void jButtonCancelActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButtonCancelActionPerformed

    if (dialog != null) {
      dialog.setVisible(false);
      dialog.dispose();
    }
  } // GEN-LAST:event_jButtonCancelActionPerformed
Esempio n. 23
0
 private static final void showup(JOptionPane jop) {
   JDialog dialog = jop.createDialog(ResourceCenter.TITLE);
   dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
   dialog.setIconImages(ResourceCenter.icons);
   dialog.setModal(true);
   dialog.setVisible(true);
   dialog.dispose();
 }
Esempio n. 24
0
    @Override
    public void dispose() {
      if (isShowing()) {
        hide();
      }

      if (myWindowListener != null) {
        myWindowListener.saveSize();
        removeWindowListener(myWindowListener);
        myWindowListener = null;
      }

      if (myComponentListener != null) {
        removeComponentListener(myComponentListener);
        myComponentListener = null;
      }

      if (myFocusTrackback != null
          && !(myFocusTrackback.isSheduledForRestore()
              || myFocusTrackback.isWillBeSheduledForRestore())) {
        myFocusTrackback.dispose();
        myFocusTrackback = null;
      }

      final BufferStrategy strategy = getBufferStrategy();
      if (strategy != null) {
        strategy.dispose();
      }
      super.dispose();

      if (rootPane != null) { // Workaround for bug in native code to hold rootPane
        try {
          Field field = rootPane.getClass().getDeclaredField("glassPane");
          field.setAccessible(true);
          field.set(rootPane, null);

          field = rootPane.getClass().getDeclaredField("contentPane");
          field.setAccessible(true);
          field.set(rootPane, null);
          rootPane = null;

          field = Window.class.getDeclaredField("windowListener");
          field.setAccessible(true);
          field.set(this, null);
        } catch (Exception ignored) {
        }
      }

      // http://bugs.sun.com/view_bug.do?bug_id=6614056
      try {
        final Field field = Dialog.class.getDeclaredField("modalDialogs");
        field.setAccessible(true);
        final List<?> list = (List<?>) field.get(null);
        list.remove(this);
      } catch (final Exception ignored) {
      }
    }
 public void dispose() {
   setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
   try {
     Thread.sleep(500);
   } catch (InterruptedException e) {
   }
   setVisible(false);
   super.dispose();
 }
Esempio n. 26
0
 private void Exit() {
   // exit
   try {
     bgd.close();
   } catch (IOException e) {
     e.printStackTrace();
   }
   maindialog.dispose();
 }
 public void testWaitForDialogWithActiveWindowAsTargetDialog() throws InterruptedException {
   JFrame frame = new JFrame();
   JDialog testDialog = new JDialog(frame, "testDialog");
   setFocusManager(testDialog);
   windowContext.propertyChange(new PropertyChangeEvent(this, "focusOwner", null, testDialog));
   windowContext.waitForDialogOpening("testDialog", 10);
   assertSame(testDialog, windowContext.activeWindow());
   testDialog.dispose();
   frame.dispose();
 }
Esempio n. 28
0
 @Override
 public void dispose() {
   removeComponentListener(componentListener);
   if (myRootParent != null) {
     myRootParent.removeComponentListener(componentListener);
     myRootParent.getRootPane().removeComponentListener(componentListener);
   }
   componentListener = null;
   super.dispose();
 }
Esempio n. 29
0
 public void dispose() {
   f.dispose();
   f = null;
   dummy.dispose();
   dummy = null;
   if (modal_d != null) {
     modal_d.dispose();
     modal_d = null;
   }
 }
 @Override
 public void actionPerformed(ActionEvent arg0) {
   JPanel dialog = MapillaryFilterChooseSigns.getInstance();
   JOptionPane pane =
       new JOptionPane(dialog, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
   JDialog dlg = pane.createDialog(Main.parent, tr("Choose signs"));
   dlg.setVisible(true);
   if ((int) pane.getValue() == JOptionPane.OK_OPTION)
     MapillaryFilterDialog.getInstance().refresh();
   dlg.dispose();
 }