Example usage for javax.swing JOptionPane QUESTION_MESSAGE

List of usage examples for javax.swing JOptionPane QUESTION_MESSAGE

Introduction

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

Prototype

int QUESTION_MESSAGE

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

Click Source Link

Document

Used for questions.

Usage

From source file:net.sf.firemox.ui.MdbListener.java

/**
 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
 *//*from  w w  w. jav a2s  .  c o m*/
public void actionPerformed(ActionEvent e) {
    if ("menu_options_tbs_more".equals(e.getActionCommand())) {
        // goto "more TBS" page
        try {
            WebBrowser.launchBrowser("http://sourceforge.net/project/showfiles.php?group_id="
                    + IdConst.PROJECT_ID + "&package_id=107882");
        } catch (Exception e1) {
            JOptionPane.showOptionDialog(MagicUIComponents.magicForm,
                    LanguageManager.getString("error") + " : " + e1.getMessage(),
                    LanguageManager.getString("web-pb"), JOptionPane.OK_OPTION, JOptionPane.INFORMATION_MESSAGE,
                    UIHelper.getIcon("wiz_update_error.gif"), null, null);
        }
        return;
    }
    if ("menu_options_tbs_update".equals(e.getActionCommand())) {
        // update the current TBS
        XmlConfiguration.main(new String[] { "-g", MToolKit.tbsName });
        return;
    }
    if ("menu_options_tbs_rebuild".equals(e.getActionCommand())) {
        /*
         * rebuild completely the current TBS
         */
        XmlConfiguration.main(new String[] { "-f", "-g", MToolKit.tbsName });
        return;
    }

    // We change the TBS

    // Wait for confirmation
    if (JOptionPane.YES_OPTION == JOptionPane.showOptionDialog(MagicUIComponents.magicForm,
            LanguageManager.getString("warn-disconnect"), LanguageManager.getString("disconnect"),
            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, UIHelper.getIcon("wiz_update.gif"), null,
            null)) {

        // Save the current settings before changing TBS
        Magic.saveSettings();

        // Copy this settings file to the profile directory of this TBS
        final File propertyFile = MToolKit.getFile(IdConst.FILE_SETTINGS);
        try {
            FileUtils.copyFile(propertyFile, MToolKit.getTbsFile(IdConst.FILE_SETTINGS_SAVED, false));

            // Delete the current settings file of old TBS
            propertyFile.delete();

            // Load the one of the new TBS
            abstractMainForm.setMdb(e.getActionCommand());
            Configuration.loadTemplateFile(
                    MToolKit.getTbsFile(IdConst.FILE_SETTINGS_SAVED, false).getAbsolutePath());

            // Copy the saved configuration of new TBS
            FileUtils.copyFile(MToolKit.getTbsFile(IdConst.FILE_SETTINGS_SAVED, false), propertyFile);
            Log.info("Successful TBS swith to " + MToolKit.tbsName);

            // Restart the game
            System.exit(IdConst.EXIT_CODE_RESTART);
        } catch (IOException e1) {
            e1.printStackTrace();
        }
    }
}

From source file:Framework.java

private boolean quitConfirmed(JFrame frame) {
    String s1 = "Quit";
    String s2 = "Cancel";
    Object[] options = { s1, s2 };
    int n = JOptionPane.showOptionDialog(frame, "Windows are still open.\nDo you really want to quit?",
            "Quit Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, s1);
    if (n == JOptionPane.YES_OPTION) {
        return true;
    } else {//from   w ww  . j a v  a 2 s  .  co m
        return false;
    }
}

From source file:net.sf.taverna.t2.activities.localworker.actions.LocalworkerActivityConfigurationAction.java

/**
 * If the localworker has not been changed it pops up a {@link JOptionPane} warning the user
 * that they change things at their own risk. Otherwise just show the config view
 *///from  w  w w.ja v  a2  s .com
public void actionPerformed(ActionEvent e) {
    Object[] options = { "Continue", "Cancel" };
    Configuration configuration = scufl2Tools.configurationFor(activity, activity.getParent());
    JsonNode json = configuration.getJson();
    if (!json.get("isAltered").booleanValue()) {
        int n = JOptionPane.showOptionDialog(null,
                "Changing the properties of a Local Worker may affect its behaviour. Do you want to continue?",
                "WARNING", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, // do not use a
                // custom Icon
                options, options[0]);

        if (n == 0) {
            // continue was clicked so prepare for config
            openDialog();
        } else {
            // do nothing
        }
    } else {
        openDialog();
    }
}

From source file:edu.ku.brc.specify.config.init.RegisterSpecify.java

/**
 * @param title//from w  ww .j a va  2s . c  om
 * @return
 */
private boolean askToReg(final String typeTitle, final String typeName) {
    Object[] options = { getResourceString("YES"), //$NON-NLS-1$
            getResourceString("NO") //$NON-NLS-1$
    };
    int userChoice = JOptionPane.showOptionDialog(UIRegistry.getTopWindow(),
            getLocalizedMessage("SpReg.DO_REG", typeTitle, typeName), //$NON-NLS-1$
            getResourceString("SpReg.DO_REG_TITLE"), //$NON-NLS-1$
            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);

    return userChoice == JOptionPane.YES_OPTION;
}

From source file:org.cds06.speleograph.graph.SeriesMenu.java

private JPopupMenu createPopupMenuForSeries(final Series series) {

    if (series == null)
        return new JPopupMenu();

    final JPopupMenu menu = new JPopupMenu(series.getName());

    menu.removeAll();//w w  w  .j av  a2  s .  c  o  m

    menu.add(new AbstractAction() {
        {
            putValue(NAME, "Renommer la srie");
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            menu.setVisible(false);
            String newName = "";
            while (newName == null || newName.equals("")) {
                newName = (String) JOptionPane.showInputDialog(application,
                        "Entrez un nouveau nom pour la srie", null, JOptionPane.QUESTION_MESSAGE, null, null,
                        series.getName());
            }
            series.setName(newName);
        }
    });

    if (series.hasOwnAxis()) {
        menu.add(new AbstractAction() {

            {
                putValue(NAME, "Supprimer l'axe spcifique");
            }

            @Override
            public void actionPerformed(ActionEvent e) {
                if (JOptionPane.showConfirmDialog(application, "tes vous sr de vouloir supprimer cet axe ?",
                        "Confirmation", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
                    series.setAxis(null);
                }
            }
        });
    } else {
        menu.add(new JMenuItem(new AbstractAction() {

            {
                putValue(NAME, "Crer un axe spcifique pour la srie");
            }

            @Override
            public void actionPerformed(ActionEvent e) {
                String name = JOptionPane.showInputDialog(application, "Quel titre pour cet axe ?",
                        series.getAxis().getLabel());
                if (name == null || "".equals(name))
                    return; // User has canceled
                series.setAxis(new NumberAxis(name));
            }
        }));
    }

    menu.add(new SetTypeMenu(series));

    if (series.isWater()) {
        menu.addSeparator();
        menu.add(new SumOnPeriodAction(series));
        menu.add(new CreateCumulAction(series));
    }
    if (series.isWaterCumul()) {
        menu.addSeparator();
        menu.add(new SamplingAction(series));
    }

    if (series.isPressure()) {
        menu.addSeparator();
        menu.add(new CorrelateAction(series));
        menu.add(new WaterHeightAction(series));
    }

    menu.addSeparator();

    menu.add(new AbstractAction() {
        {
            String name;
            if (series.canUndo())
                name = "Annuler " + series.getItemsName();
            else
                name = series.getLastUndoName();

            putValue(NAME, name);

            if (series.canUndo())
                setEnabled(true);
            else {
                setEnabled(false);
            }

        }

        @Override
        public void actionPerformed(ActionEvent e) {
            series.undo();
        }
    });

    menu.add(new AbstractAction() {
        {
            String name;
            if (series.canRedo()) {
                name = "Refaire " + series.getNextRedoName();
                setEnabled(true);
            } else {
                name = series.getNextRedoName();
                setEnabled(false);
            }

            putValue(NAME, name);
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            series.redo();
        }
    });

    menu.add(new AbstractAction() {
        {
            putValue(NAME, I18nSupport.translate("menus.serie.resetSerie"));
            if (series.canUndo())
                setEnabled(true);
            else
                setEnabled(false);
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            series.reset();
        }
    });

    menu.add(new LimitDateRangeAction(series));

    menu.add(new HourSettingAction(series));

    menu.addSeparator();

    {
        JMenuItem deleteItem = new JMenuItem("Supprimer la srie");
        deleteItem.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (JOptionPane.showConfirmDialog(application,
                        "tes-vous sur de vouloir supprimer cette srie ?\n"
                                + "Cette action est dfinitive.",
                        "Confirmation", JOptionPane.OK_CANCEL_OPTION,
                        JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) {
                    series.delete();
                }
            }
        });
        menu.add(deleteItem);
    }

    menu.addSeparator();

    {
        final JMenuItem up = new JMenuItem("Remonter dans la liste"),
                down = new JMenuItem("Descendre dans la liste");
        ActionListener listener = new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (e.getSource().equals(up)) {
                    series.upSeriesInList();
                } else {
                    series.downSeriesInList();
                }
            }
        };
        up.addActionListener(listener);
        down.addActionListener(listener);
        if (series.isFirst()) {
            menu.add(down);
        } else if (series.isLast()) {
            menu.add(up);
        } else {
            menu.add(up);
            menu.add(down);
        }
    }

    menu.addSeparator();

    {
        menu.add(new SeriesInfoAction(series));
    }

    {
        JMenuItem colorItem = new JMenuItem("Couleur de la srie");
        colorItem.addActionListener(new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                series.setColor(JColorChooser.showDialog(application,
                        I18nSupport.translate("actions.selectColorForSeries"), series.getColor()));
            }
        });
        menu.add(colorItem);
    }

    {
        JMenu plotRenderer = new JMenu("Affichage de la srie");
        final ButtonGroup modes = new ButtonGroup();
        java.util.List<DrawStyle> availableStyles;
        if (series.isMinMax()) {
            availableStyles = DrawStyles.getDrawableStylesForHighLow();
        } else {
            availableStyles = DrawStyles.getDrawableStyles();
        }
        for (final DrawStyle s : availableStyles) {
            final JRadioButtonMenuItem item = new JRadioButtonMenuItem(DrawStyles.getHumanCheckboxText(s));
            item.addChangeListener(new ChangeListener() {
                @Override
                public void stateChanged(ChangeEvent e) {
                    if (item.isSelected())
                        series.setStyle(s);
                }
            });
            modes.add(item);
            if (s.equals(series.getStyle())) {
                modes.setSelected(item.getModel(), true);
            }
            plotRenderer.add(item);
        }
        menu.add(plotRenderer);
    }
    menu.addSeparator();

    menu.add(new AbstractAction() {
        {
            putValue(Action.NAME, "Fermer le fichier");
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            if (JOptionPane.showConfirmDialog(application,
                    "tes-vous sur de vouloir fermer toutes les sries du fichier ?", "Confirmation",
                    JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) {
                final File f = series.getOrigin();
                for (final Series s : Series.getInstances().toArray(new Series[Series.getInstances().size()])) {
                    if (s.getOrigin().equals(f))
                        s.delete();
                }
            }
        }
    });

    return menu;
}

From source file:com.openbravo.pos.customers.CustomersPayment.java

/**
 *
 * @return//w  w  w  .  ja va  2s. com
 */
@Override
public boolean deactivate() {
    if (dirty.isDirty()) {
        int res = JOptionPane.showConfirmDialog(this, AppLocal.getIntString("message.wannasave"),
                AppLocal.getIntString("title.editor"), JOptionPane.YES_NO_CANCEL_OPTION,
                JOptionPane.QUESTION_MESSAGE);
        if (res == JOptionPane.YES_OPTION) {
            save();
            return true;
        } else {
            return res == JOptionPane.NO_OPTION;
        }
    } else {
        return true;
    }
}

From source file:de.dakror.virtualhub.client.dialog.ChooseCatalogDialog.java

public static void show(ClientFrame frame, final JSONArray data) {
    final JDialog dialog = new JDialog(frame, "Katalog whlen", true);
    dialog.setSize(400, 300);//from w w  w. j a  v a 2 s.  c  o  m
    dialog.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    dialog.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            Client.currentClient.disconnect();
            System.exit(0);
        }
    });

    JPanel contentPane = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0));
    dialog.setContentPane(contentPane);
    DefaultListModel dlm = new DefaultListModel();
    for (int i = 0; i < data.length(); i++) {
        try {
            dlm.addElement(data.getJSONObject(i).getString("name"));
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    final JList catalogs = new JList(dlm);
    catalogs.setDragEnabled(false);
    catalogs.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    JScrollPane jsp = new JScrollPane(catalogs, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    jsp.setPreferredSize(new Dimension(396, 200));
    contentPane.add(jsp);

    JPanel mods = new JPanel(new GridLayout(1, 2));
    mods.setPreferredSize(new Dimension(50, 22));
    mods.add(new JButton(new AbstractAction("+") {
        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent e) {
            String name = JOptionPane.showInputDialog(dialog,
                    "Bitte geben Sie den Namen des neuen Katalogs ein.", "Katalog hinzufgen",
                    JOptionPane.PLAIN_MESSAGE);
            if (name != null && name.length() > 0) {
                DefaultListModel dlm = (DefaultListModel) catalogs.getModel();
                for (int i = 0; i < dlm.getSize(); i++) {
                    if (dlm.get(i).toString().equals(name)) {
                        JOptionPane.showMessageDialog(dialog,
                                "Es existert bereits ein Katalog mit diesem Namen!",
                                "Katalog bereits vorhanden!", JOptionPane.ERROR_MESSAGE);
                        actionPerformed(e);
                        return;
                    }
                }

                try {
                    dlm.addElement(name);
                    JSONObject o = new JSONObject();
                    o.put("name", name);
                    o.put("sources", new JSONArray());
                    o.put("tags", new JSONArray());
                    data.put(o);
                    Client.currentClient.sendPacket(new Packet0Catalogs(data));
                } catch (Exception e1) {
                    e1.printStackTrace();
                }
            }
        }
    }));
    mods.add(new JButton(new AbstractAction("-") {
        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent e) {
            if (catalogs.getSelectedIndex() != -1) {
                if (JOptionPane.showConfirmDialog(dialog,
                        "Sind Sie sicher, dass Sie diesen\r\nKatalog unwiderruflich lschen wollen?",
                        "Katalog lschen", JOptionPane.YES_NO_CANCEL_OPTION,
                        JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
                    DefaultListModel dlm = (DefaultListModel) catalogs.getModel();
                    data.remove(catalogs.getSelectedIndex());
                    dlm.remove(catalogs.getSelectedIndex());
                    try {
                        Client.currentClient.sendPacket(new Packet0Catalogs(data));
                    } catch (IOException e1) {
                        e1.printStackTrace();
                    }
                }
            }
        }
    }));

    contentPane.add(mods);

    JLabel l = new JLabel("");
    l.setPreferredSize(new Dimension(396, 14));
    contentPane.add(l);

    JSeparator sep = new JSeparator(JSeparator.HORIZONTAL);
    sep.setPreferredSize(new Dimension(396, 10));
    contentPane.add(sep);

    JPanel buttons = new JPanel(new GridLayout(1, 2));
    buttons.setPreferredSize(new Dimension(396, 22));
    buttons.add(new JButton(new AbstractAction("Abbrechen") {
        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent e) {
            Client.currentClient.disconnect();
            System.exit(0);
        }
    }));
    buttons.add(new JButton(new AbstractAction("Katalog whlen") {
        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent e) {
            if (catalogs.getSelectedIndex() != -1) {
                try {
                    Client.currentClient
                            .setCatalog(new Catalog(data.getJSONObject(catalogs.getSelectedIndex())));
                    Client.currentClient.frame.setTitle("- " + Client.currentClient.getCatalog().getName());
                    dialog.dispose();
                } catch (JSONException e1) {
                    e1.printStackTrace();
                }
            }
        }
    }));

    dialog.add(buttons);

    dialog.setLocationRelativeTo(frame);
    dialog.setResizable(false);
    dialog.setVisible(true);
}

From source file:net.sf.jabref.gui.UrlDragDrop.java

@Override
public void drop(DropTargetDropEvent dtde) {
    Transferable tsf = dtde.getTransferable();
    dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
    //try with an URL
    DataFlavor dtURL = null;// w w w.  j a  v  a  2 s. co  m
    try {
        dtURL = new DataFlavor("application/x-java-url; class=java.net.URL");
    } catch (ClassNotFoundException e) {
        LOGGER.warn("Could not find DropTargetDropEvent class.", e);
    }
    try {
        URL url = (URL) tsf.getTransferData(dtURL);
        JOptionChoice res = (JOptionChoice) JOptionPane.showInputDialog(editor, "",
                Localization.lang("Select action"), JOptionPane.QUESTION_MESSAGE, null,
                new JOptionChoice[] { new JOptionChoice(Localization.lang("Insert URL"), 0),
                        new JOptionChoice(Localization.lang("Download file"), 1) },
                new JOptionChoice(Localization.lang("Insert URL"), 0));
        if (res != null) {
            switch (res.getId()) {
            //insert URL
            case 0:
                feditor.setText(url.toString());
                editor.updateField(feditor);
                break;
            //download file
            case 1:
                try {
                    //auto filename:
                    File file = new File(new File(Globals.prefs.get("pdfDirectory")),
                            editor.getEntry().getCiteKey() + ".pdf");
                    frame.output(Localization.lang("Downloading..."));
                    MonitoredURLDownload.buildMonitoredDownload(editor, url).downloadToFile(file);
                    frame.output(Localization.lang("Download completed"));
                    feditor.setText(file.toURI().toURL().toString());
                    editor.updateField(feditor);

                } catch (IOException ioex) {
                    LOGGER.error("Error while downloading file.", ioex);
                    JOptionPane.showMessageDialog(editor, Localization.lang("File download"),
                            Localization.lang("Error while downloading file:" + ioex.getMessage()),
                            JOptionPane.ERROR_MESSAGE);
                }
                break;
            default:
                LOGGER.warn("Unknown selection (should not happen)");
                break;
            }
        }
        return;
    } catch (UnsupportedFlavorException nfe) {
        // not an URL then...
        LOGGER.warn("Could not parse URL.", nfe);
    } catch (IOException ioex) {
        LOGGER.warn("Could not perform drag and drop.", ioex);
    }

    try {
        //try with a File List
        @SuppressWarnings("unchecked")
        List<File> filelist = (List<File>) tsf.getTransferData(DataFlavor.javaFileListFlavor);
        if (filelist.size() > 1) {
            JOptionPane.showMessageDialog(editor, Localization.lang("Only one item is supported"),
                    Localization.lang("Drag and Drop Error"), JOptionPane.ERROR_MESSAGE);
            return;
        }
        File fl = filelist.get(0);
        feditor.setText(fl.toURI().toURL().toString());
        editor.updateField(feditor);

    } catch (UnsupportedFlavorException nfe) {
        JOptionPane.showMessageDialog(editor, Localization.lang("Operation not supported"),
                Localization.lang("Drag and Drop Error"), JOptionPane.ERROR_MESSAGE);
        LOGGER.warn("Could not perform drag and drop.", nfe);
    } catch (IOException ioex) {
        LOGGER.warn("Could not perform drag and drop.", ioex);
    }

}

From source file:Main_Window.java

public Main_Window() {
    super("Google Places Application"); //First call Constructor of JFrame

    this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //We do not want our application to terminate when a JFrame is closed
    this.addWindowListener(new java.awt.event.WindowAdapter() {
        @Override// w w w  . j  av  a2  s.co  m
        public void windowClosing(java.awt.event.WindowEvent windowEvent) {
            int Answer = JOptionPane.showConfirmDialog(null, "Exit Application ? ", "Exit ? ",
                    JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
            if (Answer == JOptionPane.YES_OPTION) {
                if (POI_List.isEmpty()) {
                    POI_List.clear();
                }
                if (Distances_List.isEmpty()) {
                    Distances_List.clear();
                }
                if (Temp_List.isEmpty()) {
                    Temp_List.clear();
                }
                if (Distances_List_2.isEmpty()) {
                    Distances_List_2.clear();
                }
                System.exit(1);
            } else {
                setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
            }
        }
    });
    //The listener object created from that class is then registered with a Window using the window's addWindowListener method.

    //
    this.setSize(1100, 700); // Size of Window
    this.setLocationRelativeTo(null); // Display Window in center of Screen
    this.setVisible(true);
    this.getContentPane().setBackground(Color.LIGHT_GRAY);
    //

    //Initialization of J Components
    POIS_Label = new JLabel("Points of Interest:");
    POIS_Label.setForeground(Color.black);
    POIS_Label.setFont(new Font("Courier New", Font.BOLD, 25));
    POIS_Label.setBounds(600, 30, 350, 150);

    Retrieve_POIs_Button = new JButton("Retrieve POIs");
    Retrieve_POIs_Button.setForeground(Color.black);
    Retrieve_POIs_Button.setFont(new Font("Courier New", Font.BOLD, 35));
    Retrieve_POIs_Button.setBounds(25, 450, 350, 150);

    Open_Status = new JRadioButton(" Open Now?");
    Open_Status.setForeground(Color.black);
    Open_Status.setBackground(Color.LIGHT_GRAY);
    Open_Status.setBounds(20, 380, 100, 30);

    Welcome_Label = new JLabel("Welcome to Google Places");
    Welcome_Label.setForeground(Color.BLUE);
    Welcome_Label.setFont(new Font("Courier New", Font.BOLD, 35));
    Welcome_Label.setBounds(240, 20, 600, 60);

    Latitude_Label = new JLabel("Latitude:");
    Latitude_Label.setForeground(Color.BLACK);
    Latitude_Label.setFont(new Font("Courier New", Font.PLAIN, 25));
    Latitude_Label.setBounds(15, 80, 200, 100);

    Longitude_Label = new JLabel("Longitude:");
    Longitude_Label.setForeground(Color.BLACK);
    Longitude_Label.setFont(new Font("Courier New", Font.PLAIN, 25));
    Longitude_Label.setBounds(15, 130, 250, 100);

    Radius_Label = new JLabel("Radius:");
    Radius_Label.setForeground(Color.BLACK);
    Radius_Label.setFont(new Font("Courier New", Font.PLAIN, 25));
    Radius_Label.setBounds(15, 180, 250, 100);

    Category_Label = new JLabel("Category:");
    Category_Label.setForeground(Color.BLACK);
    Category_Label.setFont(new Font("Courier New", Font.PLAIN, 25));
    Category_Label.setBounds(15, 250, 250, 100);

    Latitude_TextField = new JTextField(7);
    Latitude_TextField.setForeground(Color.BLACK);
    Latitude_TextField.setBounds(165, 116, 180, 30);

    Longitude_TextField = new JTextField(7);
    Longitude_TextField.setForeground(Color.BLACK);
    Longitude_TextField.setBounds(170, 168, 180, 30);

    Radius_TextField = new JTextField(7);
    Radius_TextField.setForeground(Color.BLACK);
    Radius_TextField.setBounds(125, 215, 180, 30);

    Categories = new JComboBox(Categories_Names);
    Categories.setForeground(Color.BLACK);
    Categories.setBackground(Color.white);
    Categories.setBounds(15, 320, 180, 30);

    POI_List = new ArrayList();

    pane = getContentPane(); //Manager
    pane.setLayout(null); // Deactivate Manager Layout

    //JPANEL
    P = new JPanel();
    P.setBackground(Color.GRAY);
    P.setBounds(600, 120, 450, 180);
    P.setBackground(Color.GRAY);

    pane.add(P);
    pane.add(POIS_Label);
    pane.add(Retrieve_POIs_Button);
    pane.add(Welcome_Label);
    pane.add(Longitude_Label);
    pane.add(Latitude_Label);
    pane.add(Radius_Label);
    pane.add(Category_Label);
    pane.add(Latitude_TextField);
    pane.add(Longitude_TextField);
    pane.add(Radius_TextField);
    pane.add(Categories);
    pane.add(Open_Status);

    Retrieve_POIs_Button.addActionListener(this);

    setContentPane(pane);

}

From source file:modelibra.swing.app.util.FileSelector.java

/**
 * Prompts a user to decide if the file should be replaced: yes or no.
 * //  w  ww.j a  v  a  2  s .  c o  m
 * @param parentFrame
 *            parent window
 * @param lang
 *            language
 * @return <code>true</code> if a user chooses yes
 */
protected boolean replaceFile(JFrame parentFrame, NatLang lang) {
    // Custom button text
    Object[] options = { lang.getText("yes"), lang.getText("no") };
    JOptionPane.setDefaultLocale(lang.getLocale());
    int response = JOptionPane.showOptionDialog(parentFrame, // parent
            // frame
            lang.getText("replaceFile"), // message
            lang.getText("fileExists"), // title
            JOptionPane.YES_NO_OPTION, // option type
            JOptionPane.QUESTION_MESSAGE, // message type
            null, // don't use a custom icon
            options, // the titles of buttons
            options[0]); // default button title

    if (response == JOptionPane.NO_OPTION) {
        return false;
    }

    return true;
}