Example usage for javax.swing JOptionPane INFORMATION_MESSAGE

List of usage examples for javax.swing JOptionPane INFORMATION_MESSAGE

Introduction

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

Prototype

int INFORMATION_MESSAGE

To view the source code for javax.swing JOptionPane INFORMATION_MESSAGE.

Click Source Link

Document

Used for information messages.

Usage

From source file:org.pgptool.gui.ui.tempfolderfordecrypted.TempFolderChooserPm.java

public void present(Component parent) {
    try {//from ww w .jav  a2 s.c o m
        String newFolder = getFolderChooserDialog().askUserForFolder(parent);
        if (newFolder == null) {
            return;
        }
        UiUtils.messageBox(parent, text("phrase.settingsChangedConfirmFolder", newFolder), text("term.success"),
                JOptionPane.INFORMATION_MESSAGE);
    } catch (Throwable t) {
        log.error("Failed to save settigns for folder to use for temp decrypted files", t);
        EntryPoint.reportExceptionToUser("error.failedToSetNewTempFolder", t);
    }
}

From source file:edu.harvard.i2b2.query.QueryListNamesClient.java

public static String sendQueryRequestREST(String XMLstr) {
    try {//ww  w .ja  v a  2s . c  om
        OMElement payload = getQueryPayLoad(XMLstr);
        Options options = new Options();
        targetEPR = new EndpointReference(getCRCNavigatorQueryProcessorServiceName());
        options.setTo(targetEPR);
        options.setTo(targetEPR);
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
        options.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE);
        options.setProperty(HTTPConstants.SO_TIMEOUT, new Integer(10000));
        options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, new Integer(10000));

        ServiceClient sender = new ServiceClient();
        sender.setOptions(options);

        OMElement result = sender.sendReceive(payload);
        //System.out.println("Response XML: "+result.toString());
        return result.toString();
    } catch (AxisFault axisFault) {
        axisFault.printStackTrace();
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                JOptionPane.showMessageDialog(null,
                        "Trouble with connection to the remote server, "
                                + "this is often a network error, please try again",
                        "Network Error", JOptionPane.INFORMATION_MESSAGE);
            }
        });

        return null;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

From source file:latexstudio.editor.remote.UploadToDropbox.java

@Override
public void actionPerformed(ActionEvent e) {
    DbxClient client = DbxUtil.getDbxClient();

    if (client == null) {
        return;/*from  ww w  . j a  v  a 2 s .c  o m*/
    }

    String sourceFileName = ApplicationUtils.getTempSourceFile();
    File file = new File(sourceFileName);

    FileInputStream inputStream = null;
    try {
        inputStream = new FileInputStream(file);
    } catch (FileNotFoundException ex) {
        Exceptions.printStackTrace(ex);
    }

    String defaultFileName = etc.getCurrentFile() == null ? "welcome.tex" : etc.getCurrentFile().getName();
    String fileName = (String) JOptionPane.showInputDialog(null, "Please enter file name", "Upload file",
            JOptionPane.INFORMATION_MESSAGE, null, null, defaultFileName);
    if (fileName != null) {
        fileName = fileName.endsWith(TEX_EXTENSION) ? fileName : fileName.concat(TEX_EXTENSION);
        try {
            DbxEntry.File uploadedFile = client.uploadFile("/OpenLaTeXStudio/" + fileName, DbxWriteMode.add(),
                    file.length(), inputStream);
            JOptionPane.showMessageDialog(null,
                    "Successfuly uploaded file " + uploadedFile.name + " (" + uploadedFile.humanSize + ")",
                    "File uploaded to Dropbox", JOptionPane.INFORMATION_MESSAGE);
            revtc.close();
        } catch (DbxException ex) {
            DbxUtil.showDbxAccessDeniedPrompt();
        } catch (IOException ex) {
            Exceptions.printStackTrace(ex);
        } finally {
            IOUtils.closeQuietly(inputStream);
        }
    }
}

From source file:edu.harvard.i2b2.query.QueryRequestClient.java

public static String sendQueryRequestREST(String XMLstr) {
    try {/*from  w  ww  . j a  va  2  s.  com*/
        OMElement payload = getQueryPayLoad(XMLstr);
        Options options = new Options();
        targetEPR = new EndpointReference(getCRCNavigatorQueryProcessorServiceName());
        options.setTo(targetEPR);
        options.setTo(targetEPR);
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
        options.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE);
        options.setProperty(HTTPConstants.SO_TIMEOUT, new Integer(200000));
        options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, new Integer(200000));

        ServiceClient sender = new ServiceClient();
        sender.setOptions(options);

        OMElement result = sender.sendReceive(payload);
        //System.out.println(result.toString());
        return result.toString();
    } catch (AxisFault axisFault) {
        axisFault.printStackTrace();
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                JOptionPane.showMessageDialog(null,
                        "Trouble with connection to the remote server, "
                                + "this is often a network error, please try again",
                        "Network Error", JOptionPane.INFORMATION_MESSAGE);
            }
        });

        return null;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

From source file:BeanContainer.java

  protected JMenuBar createMenuBar() {
  JMenuBar menuBar = new JMenuBar();
    /*from   www  .  j  a  v a2 s  . com*/
  JMenu mFile = new JMenu("File");

  JMenuItem mItem = new JMenuItem("New...");
  ActionListener lst = new ActionListener() { 
    public void actionPerformed(ActionEvent e) {  
      Thread newthread = new Thread() {
        public void run() {
          String result = (String)JOptionPane.showInputDialog(
            BeanContainer.this, 
            "Please enter class name to create a new bean", 
            "Input", JOptionPane.INFORMATION_MESSAGE, null, 
            null, m_className);
          repaint();
          if (result==null)
            return;
          try {
            m_className = result;
            Class cls = Class.forName(result);
            Object obj = cls.newInstance();
            if (obj instanceof Component) {
              m_activeBean = (Component)obj;
              m_activeBean.addFocusListener(
                BeanContainer.this);
              m_activeBean.requestFocus();
              getContentPane().add(m_activeBean);
            }
            validate();
          }
          catch (Exception ex) {
            ex.printStackTrace();
            JOptionPane.showMessageDialog(
              BeanContainer.this, "Error: "+ex.toString(),
              "Warning", JOptionPane.WARNING_MESSAGE);
          }
        }
      };
      newthread.start();
    }
  };
  mItem.addActionListener(lst);
  mFile.add(mItem);

  mItem = new JMenuItem("Load...");
  lst = new ActionListener() { 
    public void actionPerformed(ActionEvent e) {  
      Thread newthread = new Thread() {
        public void run() {
          m_chooser.setCurrentDirectory(m_currentDir);
          m_chooser.setDialogTitle(
            "Please select file with serialized bean");
          int result = m_chooser.showOpenDialog(
            BeanContainer.this);
          repaint();
          if (result != JFileChooser.APPROVE_OPTION)
            return;
          m_currentDir = m_chooser.getCurrentDirectory();
          File fChoosen = m_chooser.getSelectedFile();
          try {
            FileInputStream fStream = 
              new FileInputStream(fChoosen);
            ObjectInput  stream  =  
              new ObjectInputStream(fStream);
            Object obj = stream.readObject();
            if (obj instanceof Component) {
              m_activeBean = (Component)obj;
              m_activeBean.addFocusListener(
                BeanContainer.this);
              m_activeBean.requestFocus();
              getContentPane().add(m_activeBean);
            }
            stream.close();
            fStream.close();
            validate();
          }
          catch (Exception ex) {
            ex.printStackTrace();
            JOptionPane.showMessageDialog(
              BeanContainer.this, "Error: "+ex.toString(),
              "Warning", JOptionPane.WARNING_MESSAGE);
          }
          repaint();
        }
      };
      newthread.start();
    }
  };
  mItem.addActionListener(lst);
  mFile.add(mItem);

  mItem = new JMenuItem("Save...");
  lst = new ActionListener() { 
    public void actionPerformed(ActionEvent e) {
      Thread newthread = new Thread() {
        public void run() {
          if (m_activeBean == null)
            return;
          m_chooser.setDialogTitle(
            "Please choose file to serialize bean");
          m_chooser.setCurrentDirectory(m_currentDir);
          int result = m_chooser.showSaveDialog(
            BeanContainer.this);
          repaint();
          if (result != JFileChooser.APPROVE_OPTION)
            return;
          m_currentDir = m_chooser.getCurrentDirectory();
          File fChoosen = m_chooser.getSelectedFile();
          try {
            FileOutputStream fStream = 
              new FileOutputStream(fChoosen);
            ObjectOutput stream  =  
              new ObjectOutputStream(fStream);
            stream.writeObject(m_activeBean);
            stream.close();
            fStream.close();
          }
          catch (Exception ex) {
            ex.printStackTrace();
          JOptionPane.showMessageDialog(
            BeanContainer.this, "Error: "+ex.toString(),
            "Warning", JOptionPane.WARNING_MESSAGE);
          }
        }
      };
      newthread.start();
    }
  };
  mItem.addActionListener(lst);
  mFile.add(mItem);

  mFile.addSeparator();

  mItem = new JMenuItem("Exit");
  lst = new ActionListener() { 
    public void actionPerformed(ActionEvent e) {
      System.exit(0);
    }
  };
  mItem.addActionListener(lst);
  mFile.add(mItem);
  menuBar.add(mFile);
    
  JMenu mEdit = new JMenu("Edit");

  mItem = new JMenuItem("Delete");
  lst = new ActionListener() { 
    public void actionPerformed(ActionEvent e) {
      if (m_activeBean == null)
        return;
      Object obj = m_editors.get(m_activeBean);
      if (obj != null) {
        BeanEditor editor = (BeanEditor)obj;
        editor.dispose();
        m_editors.remove(m_activeBean);
      }
      getContentPane().remove(m_activeBean);
      m_activeBean = null;
      validate();
      repaint();
    }
  };
  mItem.addActionListener(lst);
  mEdit.add(mItem);

  mItem = new JMenuItem("Properties...");
  lst = new ActionListener() { 
    public void actionPerformed(ActionEvent e) {
      if (m_activeBean == null)
        return;
      Object obj = m_editors.get(m_activeBean);
      if (obj != null) {
        BeanEditor editor = (BeanEditor)obj;
        editor.setVisible(true);
        editor.toFront();
      }
      else {
        BeanEditor editor = new BeanEditor(m_activeBean);
        m_editors.put(m_activeBean, editor);
      }
    }
  };
  mItem.addActionListener(lst);
  mEdit.add(mItem);
  menuBar.add(mEdit);

  JMenu mLayout = new JMenu("Layout");
  ButtonGroup group = new ButtonGroup();

  mItem = new JRadioButtonMenuItem("FlowLayout");
  mItem.setSelected(true);
  lst = new ActionListener() { 
    public void actionPerformed(ActionEvent e){
      getContentPane().setLayout(new FlowLayout());
      validate();
      repaint();
    }
  };
  mItem.addActionListener(lst);
  group.add(mItem);
  mLayout.add(mItem);

  mItem = new JRadioButtonMenuItem("GridLayout");
  lst = new ActionListener() { 
    public void actionPerformed(ActionEvent e){
      int col = 3;
      int row = (int)Math.ceil(getContentPane().
        getComponentCount()/(double)col);
      getContentPane().setLayout(new GridLayout(row, col, 10, 10));
      validate();
      repaint();
    }
  };
  mItem.addActionListener(lst);
  group.add(mItem);
  mLayout.add(mItem);
    
  mItem = new JRadioButtonMenuItem("BoxLayout - X");
  lst = new ActionListener() { 
    public void actionPerformed(ActionEvent e) {
      getContentPane().setLayout(new BoxLayout(
        getContentPane(), BoxLayout.X_AXIS));
      validate();
      repaint();
    }
  };
  mItem.addActionListener(lst);
  group.add(mItem);
  mLayout.add(mItem);
    
  mItem = new JRadioButtonMenuItem("BoxLayout - Y");
  lst = new ActionListener() { 
    public void actionPerformed(ActionEvent e) {
      getContentPane().setLayout(new BoxLayout(
        getContentPane(), BoxLayout.Y_AXIS));
      validate();
      repaint();
    }
  };
  mItem.addActionListener(lst);
  group.add(mItem);
  mLayout.add(mItem);
    
  mItem = new JRadioButtonMenuItem("DialogLayout");
  lst = new ActionListener() { 
    public void actionPerformed(ActionEvent e) {
      getContentPane().setLayout(new DialogLayout());
      validate();
      repaint();
    }
  };
  mItem.addActionListener(lst);
  group.add(mItem);
  mLayout.add(mItem);

  menuBar.add(mLayout);

  return menuBar;
}

From source file:net.sf.firemox.tools.MSaveDeck.java

/**
 * Saves deck to ASCII file from specified staticTurnLists. This new file will
 * contain the card names sorted in alphabetical order with their quantity
 * with this format :<br>//from   w w  w  .j a v a2 s . c o m
 * <i>card's name </i> <b>; </b> <i>qty </i> <b>\n </b> <br>
 * 
 * @param fileName
 *          Name of new file.
 * @param names
 *          ListModel of card names.
 * @param parent
 *          the parent
 * @return true if the current deck has been correctly saved. false otherwise.
 */
public static boolean saveDeck(String fileName, MListModel<MCardCompare> names, JFrame parent) {
    PrintWriter outStream = null;
    try {
        // create the deckfile. If it was already existing, it would be scrathed.
        outStream = new PrintWriter(new FileOutputStream(fileName));
    } catch (FileNotFoundException ex) {
        JOptionPane.showMessageDialog(parent,
                "Cannot create/modify the specified deck file:" + fileName + "\n" + ex.getMessage(),
                "File creation problem", JOptionPane.ERROR_MESSAGE);
        return false;
    }

    Object[] namesArray = names.toArray();
    MCardCompare[] cards = new MCardCompare[namesArray.length];
    System.arraycopy(namesArray, 0, cards, 0, namesArray.length);

    // sorts names
    Arrays.sort(cards, new MCardCompare());
    // writes lines corresponding to this format : "card;quantity\n"
    for (int i = 0; i < cards.length; i++) {
        outStream.println(cards[i].toString());
    }
    IOUtils.closeQuietly(outStream);

    // successfull deck save
    JOptionPane.showMessageDialog(parent,
            "Saving file " + fileName.substring(fileName.lastIndexOf("/") + 1) + " was successfully completed.",
            "Save success", JOptionPane.INFORMATION_MESSAGE);
    return true;
}

From source file:userInteface.Patient.ManageVitalSignsJPanel.java

private void populatePatientsTable(ArrayList<Person> personList) {
    DefaultTableModel model = (DefaultTableModel) viewPatientsJTable.getModel();
    model.setRowCount(0);//from  www . j a  v a 2  s.com
    if (personList.isEmpty()) {
        JOptionPane.showMessageDialog(this, "No Persons found. Please add Persons", "Error",
                JOptionPane.INFORMATION_MESSAGE);
        return;
    }
    for (Person person : personList) {
        Object[] row = new Object[3];
        row[0] = person;
        row[1] = person.getAge();
        if (person.getPatient() != null) {
            row[2] = person.getPatient().getPatientID();
        } else {
            row[2] = "Patient Not Created";
        }

        model.addRow(row);
    }
}

From source file:latexstudio.editor.remote.SaveProgress.java

@Override
public void actionPerformed(ActionEvent e) {
    DbxClient client = DbxUtil.getDbxClient();

    if (client == null) {
        return;/*from  w  w w .  ja  v a2  s .c  o m*/
    }

    String sourceFileName = ApplicationUtils.getTempSourceFile();
    File file = new File(sourceFileName);

    FileInputStream inputStream = null;
    try {
        inputStream = new FileInputStream(file);
    } catch (FileNotFoundException ex) {
        Exceptions.printStackTrace(ex);
    }

    DbxState dbxState = etc.getDbxState();

    if (dbxState != null) {
        try {
            DbxEntry.File uploadedFile = client.uploadFile(dbxState.getPath(),
                    DbxWriteMode.update(dbxState.getRevision()), file.length(), inputStream);
            JOptionPane.showMessageDialog(null,
                    "Successfuly updated file " + uploadedFile.name + " (" + uploadedFile.humanSize + ")",
                    "File updated in Dropbox", JOptionPane.INFORMATION_MESSAGE);
            drtc.updateRevisionsList(uploadedFile.path);
            etc.setDbxState(new DbxState(uploadedFile.path, uploadedFile.rev));
        } catch (DbxException ex) {
            DbxUtil.showDbxAccessDeniedPrompt();
        } catch (IOException ex) {
            Exceptions.printStackTrace(ex);
        } finally {
            IOUtils.closeQuietly(inputStream);
        }
    } else {
        JOptionPane.showMessageDialog(null,
                "No Dropbox file has been loaded.\n" + "You must open Dropbox file, before you save it.",
                "Cannot save progress", JOptionPane.WARNING_MESSAGE);
    }
}

From source file:com.aw.swing.mvp.ui.msg.MessageDisplayerImpl.java

/**
 * Show a message used to inform to the user of something that happened
 *
 * @param message/*ww w . ja  va2  s . c om*/
 */
public static void showMessage(Component parentContainer, String message) {
    ProcessMsgBlocker.instance().removeMessage();
    JOptionPane.showMessageDialog(parentContainer, message, GENERIC_MESSAGE_TITLE,
            JOptionPane.INFORMATION_MESSAGE);
}

From source file:com.googlecode.logVisualizer.chart.AreaListChartMouseEventListener.java

public void chartMouseClicked(final ChartMouseEvent e) {
    if (e.getEntity() instanceof CategoryItemEntity) {
        final CategoryItemEntity entity = (CategoryItemEntity) e.getEntity();
        final String areaName = (String) entity.getColumnKey();

        final StringBuilder str = new StringBuilder(100);
        for (final TurnInterval ti : logData.getTurnIntervalsSpent())
            if (ti.getAreaName().equals(areaName))
                str.append(ti + "\n");

        final JScrollPane text = new JScrollPane(new JTextArea(str.toString()));
        text.setPreferredSize(new Dimension(450, 200));
        JOptionPane.showMessageDialog(null, text, "Occurences of turns spent at " + areaName,
                JOptionPane.INFORMATION_MESSAGE);
    }/*from   w w w  .j  av  a 2 s .  c  o  m*/
}