Example usage for javax.swing JOptionPane showMessageDialog

List of usage examples for javax.swing JOptionPane showMessageDialog

Introduction

In this page you can find the example usage for javax.swing JOptionPane showMessageDialog.

Prototype

public static void showMessageDialog(Component parentComponent, Object message) throws HeadlessException 

Source Link

Document

Brings up an information-message dialog titled "Message".

Usage

From source file:Model.OpMenu.java

public void Compra(String item, int quantidade, float total) {
    it.LeArquivo();//  w  w  w .ja v  a  2s  . c  o m
    te.LeArquivo();

    Item aux = new Item();
    Compra compra = new Compra();

    aux = it.BuscaItem(item);
    compra.setItem_comprado(aux);
    Estoque estoque_aux = new Estoque();
    estoque_aux = te.BuscaIt(item);

    if (aux != null) {
        it.LeArquivo();
        compra.setQuantidade_comprada(quantidade);
        estoque_aux.setQuantidade(compra.quantidade_comprada + estoque_aux.quantidade);
        estoque_aux.setQuant(compra.quantidade_comprada + estoque_aux.quant);
        compra.setTotal(total);
        String item_comprado;
        item_comprado = aux.getArtigo();
        tc.SalvaArquivo(compra);
        tc.Add(compra);
        te.SalvaArquivo(estoque_aux);
        JOptionPane.showMessageDialog(null, "Item estocado com sucesso");
    }

    else
        JOptionPane.showMessageDialog(null, "Compra mal sucedida: Item nao cadastrado");

}

From source file:App.classes.BD_Connection.java

public static void liberateConection(Connection conection) {
    try {/*from w w  w .  j a  v  a 2 s .co m*/
        if (null != conection) // En realidad no cierra, solo libera la conexion.
        {
            conection.close();
        }
    } catch (SQLException e) {
        JOptionPane.showMessageDialog(null, e.toString());
    }
}

From source file:PersistentFrameTest.java

 public void save()
{
   if (chooser.showSaveDialog(null) == JFileChooser.APPROVE_OPTION)
   {//  w ww. j  av a 2  s  . c om
      try
      {
         File file = chooser.getSelectedFile();
         XMLEncoder encoder = new XMLEncoder(new FileOutputStream(file));
         encoder.writeObject(frame);
         encoder.close();
      }
      catch (IOException e)
      {
         JOptionPane.showMessageDialog(null, e);
      }
   }
}

From source file:CommandLineInterpreter.java

/**
 *
 *
 * @param message// www .  ja  v a 2s .com
 * @param guiAlert
 */
private static void alert(String message, final boolean guiAlert) {
    if (message != null) {
        System.out.println("[ERROR] " + message);
        if (guiAlert) {
            JOptionPane.showMessageDialog(null, message);
        }
    }
}

From source file:grafix.graficos.indices.Indice.java

protected XYDataset getDataSet(JanelaGraficos janela) {
    if (valoresEstaoDesatualizados(janela)) {
        calcularValoresIndice(janela.getAcao());
    }/* w w w .j  av a  2s  . c  om*/
    if (getValores() == null) {
        setValores(
                new ValoresIndice(this, janela.getAcao(), new double[janela.getAcao().getNumeroRegistros()]));
        JOptionPane.showMessageDialog(null, "ndice " + this.getNomeIndice() + " no retorna dados!");
    }
    return getValores().getDataSet(janela);
}

From source file:biz.wolschon.finance.jgnucash.actions.FileBugInBrowserAction.java

@Override
public void actionPerformed(final ActionEvent aE) {
    try {//w  ww .  j  a va 2  s  .  c o  m
        final URL fileABugURL = new URL("https://sourceforge.net/tracker2/?group_id=147662&atid=769090");
        showDocument(fileABugURL);
    } catch (MalformedURLException e) {
        LOGGER.error("Error, cannot launch web browser", e);
        JOptionPane.showMessageDialog(null, "Error, cannot launch web browser:\n" + e.getLocalizedMessage());
    }
}

From source file:com.quattroresearch.antibody.SequenceFileReader.java

/**
 * {@inheritDoc}/*from  w w  w  .  j a v a2 s .c om*/
 */
@Override
public List<String>[] read(JFrame parentFrame, File file)
        throws IllegalArgumentException, HeadlessException, IOException {
    this.parentFrame = parentFrame;

    List<String>[] result;
    if (FileUtils.isFastaFile(getFileContent(file))) {
        result = readFastaFile(file);
    } else if (FileUtils.isVNTProteinFile(getFileContent(file))) {
        result = readGPFile(file);
    } else {
        String exceptionText = "The content of the file is not a fasta nor a VNT protein format. Please use only these file formats.";
        JOptionPane.showMessageDialog(parentFrame, exceptionText);
        throw new IllegalArgumentException(exceptionText);
    }
    return result;
}

From source file:com.u2apple.rt.ui.worker.DeviceWorker.java

@Override
protected void done() {
    try {/*from www  . ja va 2  s. c  o m*/
        //get the data fetched above, in doInBackground()
        List<AndroidDevice> androidDevices = get();
        if (androidDevices != null && !androidDevices.isEmpty()) {
            DeviceDetailTableModel tableModel = (DeviceDetailTableModel) deviceDetailTable.getModel();
            tableModel.setAndroidDevices(androidDevices);
            tableModel.fireTableDataChanged();
        }
    } catch (InterruptedException | ExecutionException ex) {
        JOptionPane.showMessageDialog(deviceDetailTable.getParent().getParent().getParent(), ex.getMessage());
    }
}

From source file:kuvalataaja.user_interface.GUI.java

/**
 * Opens the tutorial in a popup.
 */
private void openTutorial() {
    JOptionPane.showMessageDialog(this, kuvalataaja.kuvalataaja.Tutorial.run());
}

From source file:biz.wolschon.finance.jgnucash.mysql.MySQLDataSource.java

/**
 * {@inheritDoc}//from   w w  w  .ja  va 2  s. c  o m
 * @see biz.wolschon.finance.jgnucash.plugin.DataSourcePlugin#loadFile()
 */
@Override
public GnucashWritableFile loadFile() throws IOException, JAXBException {
    JOptionPane.showMessageDialog(null, "WARNING! MySQL-support is still incomplete");
    try {
        com.mysql.jdbc.Driver driver = new com.mysql.jdbc.Driver();
        //Class.forName("com.mysql.jdbc.Driver").newInstance();

        //            SimpleDriverDataSource dataSource = new SimpleDriverDataSource(driver, "jdbc:mysql://localhost/gnucash", "root", "");
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        ClassUtils.setDefaultClassLoader(getClassLoader());
        try {
            dataSource.setDriverClassName("com.mysql.jdbc.Driver");
        } catch (Exception e) {
            e.printStackTrace(); //ignored
        }
        dataSource.setUrl("jdbc:mysql://localhost/gnucash");
        dataSource.setUsername("root");
        dataSource.setPassword("");

        return new GnucashDatabase(dataSource);
    } catch (Exception e) {
        LOG.log(Level.SEVERE, "Cannot open database-connection", e);
    }
    return null;
}