Example usage for javax.swing JOptionPane PLAIN_MESSAGE

List of usage examples for javax.swing JOptionPane PLAIN_MESSAGE

Introduction

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

Prototype

int PLAIN_MESSAGE

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

Click Source Link

Document

No icon is used.

Usage

From source file:se.trixon.mapollage.ui.MainFrame.java

private void showOptions() {
    OptionsPanel optionsPanel = new OptionsPanel();
    SwingHelper.makeWindowResizable(optionsPanel);

    Object[] options = new Object[] { AlmondOptionsPanel.getGlobalOptionsButton(optionsPanel), new JSeparator(),
            Dict.CANCEL, Dict.OK };//from w ww. j  av  a 2  s. c  o m
    int retval = JOptionPane.showOptionDialog(this, optionsPanel, Dict.OPTIONS.toString(),
            JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, Dict.OK);

    if (retval == Arrays.asList(options).indexOf(Dict.OK)) {
        optionsPanel.save();
    }
}

From source file:se.trixon.pacoma.ui.MainFrame.java

private void editCollage(Collage collage) {
    String title = Dict.Dialog.TITLE_EDIT_PROPERTIES.toString();
    boolean existing = true;
    if (collage == null) {
        collage = new Collage();
        collage.addPropertyChangeListener(mCollagePropertyChangeListener);
        title = mBundleUI.getString("create_new_collage");
        existing = false;/*from ww w.j  av  a2  s .c o m*/
    }

    PropertiesPanel propertiesPanel = new PropertiesPanel(collage);
    SwingHelper.makeWindowResizable(propertiesPanel);

    int result = JOptionPane.showOptionDialog(this, propertiesPanel, title, JOptionPane.OK_CANCEL_OPTION,
            JOptionPane.PLAIN_MESSAGE, null, null, null);

    if (result == JOptionPane.YES_OPTION) {
        propertiesPanel.store();
        mCollage = collage;

        if (!existing) {
            mActionManager.setEnabledDocumentActions(true);
            mCollage.setName(String.format("%s %d", Dict.UNTITLED.toString(), ++sDocumentCounter));
        }
    }
}

From source file:simplesqlformatter.formatter.SQLFormatterEditor.java

private void createHelpMenu(JMenuBar menuBar, JToolBar toolBar) {
    final JMenu menuHelp = new JMenu("Help");
    final GuiAction about = new GuiAction("About", "/icons/help_about.gif");
    about.setShortcutKey(KeyStroke.getKeyStroke("control H"));
    about.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent actionevent) {
            JOptionPane.showMessageDialog(SQLFormatterEditor.this, Version.about(), Version.getProductName(),
                    JOptionPane.PLAIN_MESSAGE);
        }//from w  ww . ja v a  2s  .  c  o m
    });
    menuHelp.add(about);

    menuBar.add(menuHelp);
}

From source file:SkypeBot.QA_System.java

@Override
public void run() {
    // if Skye user not login or Skype not installed.
    if (listModel.isEmpty() || (!isSkypeLogin())) {
        JOptionPane.showConfirmDialog(null,
                "1. Please install Skype 6.xx\n   (higher version not working with any 3rd party application)\n2. Login your skype account\n3. Start Skypebot again",
                "Login message", JOptionPane.PLAIN_MESSAGE, JOptionPane.ERROR_MESSAGE, null);
        System.exit(0);/*  w  w  w  .  j  a va 2s  . com*/
    }

    else if (isSkypeLogin()) {
        updateStatus();
        try {
            Skype.clearChatHistory();
            Skype.clearCallHistory();

            Skype.setDaemon(false);
            Skype.addChatMessageListener(new ChatMessageAdapter() {
                @Override
                public void chatMessageReceived(ChatMessage received) throws SkypeException {
                    if (received.getType().equals(ChatMessage.Type.SAID) && isSkypeLogin()) {

                        // get sender information
                        User sender = received.getSender();

                        // get sender ID
                        senderID = sender.getId();

                        // get sender question string in lower case
                        question = received.getContent().toLowerCase();

                        // set answer from record
                        answer = "";
                        answer = getAnswer(question);

                        // clear CHAT text area lines exceed from 100 lines
                        if (chatTextArea.getLineCount() > 100) {
                            chatTextArea.setText("");
                        }

                        // if answer found
                        //                            System.out.println(sender.getId() + " : " + question);          // use only for text interface

                        if (!answer.equals("")) {
                            // send answer to sender
                            received.getSender().send(answer);

                            // print sender question and QA answer processed for sender 
                            //                                 System.out.println("Response : " + answer);    // use only for text interface

                            chatTextArea.setFont(new Font("Courier New", Font.PLAIN, 11));
                            chatTextArea.append(
                                    "\n" + sender.getId() + " : " + question + "\nResponse : " + answer + "\n"); // use only for GUI interface

                            // ----------------------------- save user CHAT data in userID.log file -----------------------------  
                            outFile = new File(fullPath + getSenderID() + ".log"); // fullPath provide full path of file when run using .jar

                            if (!outFile.exists()) {
                                try {
                                    outFile.createNewFile();
                                } catch (IOException ex) {

                                }
                            }
                            try {
                                // append data using "true" option
                                fileWriter = new FileWriter(outFile, true);
                                fileWriter.append(String.format("%tc\n", new Date()));
                                fileWriter.append("Question : " + question + "\n");
                                fileWriter.append("Answer : " + answer + "\n\n");
                                fileWriter.close();
                            } catch (IOException ex) {

                            }
                            // ---------------------------------------------------------- 
                        } else if (answer.equals("")) {
                            // send answer to sender
                            received.getSender().send("Response : No results found for \"" + question + "\"");

                            // print sender question and QA answer processed for sender 
                            //                                 System.out.println("Response : No results found for \"" + question+"\"");  // use only for text interface

                            chatTextArea.setFont(new Font("Courier New", Font.PLAIN, 11));
                            chatTextArea.append("\n" + sender.getId() + " : " + question
                                    + "\nResponse : No results found for \"" + question + "\"" + "\n"); // use only for GUI interface

                            // ----------------------------- unknown questions in file for future use -----------------------------  
                            outFile = new File(fullPath + "unknownQuestion.txt"); // fullPath provide full path of file when run using .jar

                            if (!outFile.exists()) {
                                try {
                                    outFile.createNewFile();
                                } catch (IOException ex) {

                                }
                            }
                            try {
                                // append data using "true" option
                                fileWriter = new FileWriter(outFile, true);
                                fileWriter.append(String.format("%s\n", question));
                                fileWriter.close();
                            } catch (IOException ex) {

                            }
                            // ---------------------------------------------------------- 
                        }

                    }
                }
            });
        } catch (SkypeException ex) {

        }
    }
}

From source file:streamme.visuals.Main.java

/**
 * Creates new form Main/*  w  w w . j  a  v a 2 s. c o m*/
 */
public Main() {
    player = Player.getInstance();
    player.setListener(this);

    setIconImage(
            Toolkit.getDefaultToolkit().getImage(getClass().getClassLoader().getResource("res/icon32.png")));
    loadTray();

    hotkeyProvider = Provider.getCurrentProvider(false);
    hotkeyProvider.register(KeyStroke.getKeyStroke("alt UP"), new HotKeyListener() {
        public void onHotKey(HotKey hotKey) {
            btn_playPauseActionPerformed(null);
        }
    });
    hotkeyProvider.register(KeyStroke.getKeyStroke("alt RIGHT"), new HotKeyListener() {
        public void onHotKey(HotKey hotKey) {
            btn_nextActionPerformed(null);
        }
    });
    hotkeyProvider.register(KeyStroke.getKeyStroke("alt LEFT"), new HotKeyListener() {
        public void onHotKey(HotKey hotKey) {
            btn_prevActionPerformed(null);
        }
    });
    hotkeyProvider.register(KeyStroke.getKeyStroke("alt DOWN"), new HotKeyListener() {
        public void onHotKey(HotKey hotKey) {
            btn_stopActionPerformed(null);
        }
    });

    try {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
            if ("Windows".equals(info.getName())) {
                javax.swing.UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (ClassNotFoundException ex) {
        java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
        java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
        java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    }

    initComponents();
    //getContentPane().setBackground(new java.awt.Color(123,161,214));
    PlaylistManager.get().setFrame(this);

    this.setLocationRelativeTo(null);

    treeMenu = new JPopupMenu();

    JMenuItem itemOpenToNew = new JMenuItem("Open to a new playlist");
    itemOpenToNew.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree_files.getLastSelectedPathComponent();
            if (node == null)
                return;
            DataNode dn = (DataNode) node.getUserObject();
            int idx = PlaylistManager.get().addPlaylist(dn.getName());
            addToPlaylist(node, idx, true);
        }
    });

    JMenuItem itemAdd = new JMenuItem("Add to selected playlist...");
    itemAdd.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree_files.getLastSelectedPathComponent();
            if (node == null)
                return;
            addToPlaylist(node, playlistsPanel.getSelectedIndex(), true);
        }
    });

    treeMenu.add(itemOpenToNew);
    treeMenu.add(itemAdd);
    //tree_files.setComponentPopupMenu(menu);

    renamePlaylistKeyListener = new KeyListener() {
        @Override
        public void keyTyped(KeyEvent e) {
        }

        @Override
        public void keyPressed(KeyEvent e) {
        }

        @Override
        public void keyReleased(KeyEvent e) {
            if (e.getKeyCode() == 113) { // F2
                int idx = playlistsPanel.getSelectedIndex();
                if (idx < 0)
                    return;
                String oldTitle = playlistsPanel.getTitleAt(idx);
                String s = (String) JOptionPane.showInputDialog(Main.this, "Rename playlist:",
                        "Rename playlist", JOptionPane.PLAIN_MESSAGE, null, null, oldTitle);
                if (s != null) {
                    PlaylistManager.get().renameTab(idx, s);
                }
            }
        }
    };

    playlistsPanel.addKeyListener(renamePlaylistKeyListener);
}

From source file:uk.ac.abdn.csd.p2p.server.ServerGUI.java

/**
 * This method is invoked when SEARCH NODE menu item is pressed on P2P Visualisation Server interface.
 * @param evt Indicates the associated event.
 *//*from  ww w  . jav  a2 s  .  c om*/
private void findNodeMenuItemMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
    Collection<Vertex> allVertices = overlay.getVertices();
    ArrayList<String> allNodes = new ArrayList<String>();
    Iterator<Vertex> it = allVertices.iterator();
    while (it.hasNext()) {
        allNodes.add(it.next().getNodeName());
    }
    Object[] names = allNodes.toArray();
    String nodeName = null;

    try {
        nodeName = ((String) JOptionPane.showInputDialog(this, "Select Node from List", "Find Node",
                JOptionPane.PLAIN_MESSAGE, null, names, null)).trim();
    } catch (Exception e) {
    }

    if (PreviousNode != null) {
        PreviousNode.setColor(nodeColour);
        revalidation();
    }

    if ((nodeName != null) && (nodeName.length() > 0) && (vertices.containsKey(nodeName))) {
        findNode = vertices.get(nodeName);
        PreviousNode = findNode;
        findNode.setColor(searchColour);
        revalidation();
    }
}

From source file:uk.ac.ucl.cs.cmic.giftcloud.uploadapp.GiftCloudDialogs.java

public String showTextInputDialog(final Component component, final String message,
        final Optional<String> defaultName) throws IOException {
    final String initialName = defaultName.isPresent() ? defaultName.get() : "";

    String returnString = "";

    while (returnString.length() < 1) {
        final Object returnValue = JOptionPane.showInputDialog(component, message, applicationName,
                JOptionPane.PLAIN_MESSAGE, icon, null, initialName);
        if (returnValue == null) {
            throw new CancellationException("User cancelled template saving");
        }//from  w  w  w  . j ava2  s  . c  o m
        if (!(returnValue instanceof String)) {
            throw new RuntimeException("Bad return type");
        }
        returnString = (String) returnValue;
    }
    return returnString;
}

From source file:us.ihmc.codecs.loader.OpenH264Downloader.java

private static void acceptLicenseGUI() {

    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
    JTextArea license = new JTextArea(getLicenseText());
    license.setEditable(false);//from  www .j a  va 2s . c  o m
    license.setLineWrap(true);
    license.setWrapStyleWord(true);
    JScrollPane scroll = new JScrollPane(license);
    scroll.setPreferredSize(new Dimension(500, 500));
    panel.add(scroll);
    panel.add(new JLabel("Do you accept the OpenH264 License?"));

    if (JOptionPane.showOptionDialog(null, panel, "OpenH264 Video Codec provided by Cisco Systems, Inc.",
            JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, null) != JOptionPane.YES_OPTION) {
        JOptionPane.showMessageDialog(null, "User did not accept OpenH264 license", "License not accepted",
                JOptionPane.ERROR_MESSAGE);
        System.exit(-1);
    }

}

From source file:us.ihmc.codecs.loader.OpenH264Downloader.java

/**
 * Shows an about dialog for the license with disable button, as per license terms
 *//*from ww  w. j ava  2 s .  c o  m*/
public static void showAboutCiscoDialog() {
    JPanel panel = new JPanel();
    panel.add(new JLabel("OpenH264 Video Codec provided by Cisco Systems, Inc."));
    panel.add(new JLabel("License terms"));

    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
    JTextArea license = new JTextArea(getLicenseText());
    license.setEditable(false);
    license.setLineWrap(true);
    license.setWrapStyleWord(true);
    JScrollPane scroll = new JScrollPane(license);
    scroll.setPreferredSize(new Dimension(500, 500));
    panel.add(scroll);

    String[] options = new String[2];

    boolean enabled = isEnabled();
    if (enabled) {
        options[0] = "Disable Cisco OpenH264 plugin";
    } else {
        options[0] = "Enable Cisco OpenH264 plugin";
    }
    options[1] = "Close";

    int res = JOptionPane.showOptionDialog(null, panel, "OpenH264 Video Codec provided by Cisco Systems, Inc.",
            JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, null);

    if (res == 0) {
        if (enabled) {
            deleteOpenH264Library();
        } else {
            loadOpenH264(false);
        }
    }
}

From source file:utils.ZTransform.java

@Override
public void actionPerformed(ActionEvent e) {
    List<CMatrix> loadedCMatrices = CoolMapMaster.getLoadedCMatrices();
    if (loadedCMatrices == null || loadedCMatrices.isEmpty()) {
        Messenger.showWarningMessage("No datasets were imported.", "No data");
        return;//  ww w .  j a v a  2 s  . c o m
    }

    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {
            JTable table = new JTable();
            DefaultTableModel defaultTableModel = Utils.getDefaultTableModel();
            table.setModel(defaultTableModel);
            table.getColumnModel().removeColumn(table.getColumnModel().getColumn(0));
            table.getTableHeader().setReorderingAllowed(false);

            int returnVal = JOptionPane.showConfirmDialog(CoolMapMaster.getCMainFrame(), new JScrollPane(table),
                    "Select data", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
            if (returnVal == JOptionPane.OK_OPTION) {
                int[] selectedRows = table.getSelectedRows();
                ArrayList<CMatrix> selectedMatrices = new ArrayList<CMatrix>();
                for (int row : selectedRows) {

                    int index = table.convertRowIndexToModel(row);
                    try {
                        String ID = table.getModel().getValueAt(index, 0).toString();
                        CMatrix mx = CoolMapMaster.getCMatrixByID(ID);
                        if (mx != null) {
                            selectedMatrices.add(mx);
                        }
                    } catch (Exception e) {

                    }
                }
                //do
                createZTransform(selectedMatrices);
            }
        }
    });

}