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:edu.ku.brc.specify.config.init.RegisterSpecify.java

/**
 * @param regType/*from   w w  w  .j ava 2s.co  m*/
 * @param isAnonymous
 * @param isForISANumber
 */
private void doStartRegister(final RegisterType regType, final boolean isAnonymous,
        final boolean isForISANumber) {
    // Create a SwingWorker to connect to the server in the background, then show results on the Swing thread
    SwingWorker workerThread = new SwingWorker() {
        @Override
        public Object construct() {
            // connect to the server, sending usage stats if allowed, and gathering the latest modules version info
            try {
                return doRegisterInternal(regType, isAnonymous, isForISANumber);
            } catch (ConnectionException e) {
                // do nothing
                return null;

            } catch (Exception e) {
                edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(RegisterSpecify.class, e);
                // if any exceptions occur, return them so the finished() method can have them
                return e;
            }
        }

        @Override
        public void finished() {
            Object retVal = getValue();
            if (retVal != null) {
                // if an exception occurred during update check...
                if (retVal instanceof String) {
                    if (!isForISANumber) {
                        String regNumber = (String) retVal;
                        switch (regType) {
                        case Institution:
                            setInstitutionHasAutoRegistered(regNumber, isAnonymous);
                            break;

                        case Division:
                            setDivisionHasRegistered(regNumber, isAnonymous);
                            break;

                        case Discipline:
                            setDisciplineHasRegistered(regNumber, isAnonymous);
                            break;

                        case Collection:
                            setCollectionHasRegistered(regNumber, isAnonymous);
                            break;
                        } // switch

                    } else {
                        Collection collection = AppContextMgr.getInstance().getClassObject(Collection.class);

                        String isaTitle = getResourceString("SpReg.ISA_TITLE");

                        collection = update(Collection.class, collection);
                        UIRegistry.showLocalizedMsg(JOptionPane.INFORMATION_MESSAGE, isaTitle,
                                "SpReg.ISA_ACCEPTED", collection.getIsaNumber());
                        return;
                    }
                }
            } else if (isForISANumber && RegisterSpecify.this.hasConnection) {
                UIRegistry.showLocalizedError("SpReg.ISA_ERROR");
            }
        }
    };

    // start the background task
    workerThread.start();
}

From source file:ch.zhaw.iamp.rct.Controller.java

/**
 * Calculates the weights configured in {@link WeightsCalculatorWindow} and
 * writes the result to the also configure output file.
 *//*  ww w.  j  a  v a2 s .  co  m*/
public void calculateWeights() {
    weightCalulation = new Thread() {
        @Override
        public void run() {

            try {
                long startTime = System.currentTimeMillis();

                Weights.calculateWeights(weightsCalculatorWindow.getSpringLengthsPath(),
                        weightsCalculatorWindow.getAnglesPath(), weightsCalculatorWindow.getOutputPath(),
                        weightsCalculatorWindow.getNumberOfOffsetSteps());

                weightsCalculatorWindow.configureGuiForCalculationPhase(false);
                JOptionPane.showMessageDialog(weightsCalculatorWindow,
                        "Calculation complete. The opartion took " + getDuration(startTime), "Complete",
                        JOptionPane.INFORMATION_MESSAGE);
            } catch (HeadlessException ex) {
                JOptionPane.showMessageDialog(weightsCalculatorWindow, "An error occurred: " + ex.getMessage(),
                        "Error", JOptionPane.ERROR_MESSAGE);
            }
        }

        private String getDuration(long startTime) {
            long durationInMilliseconds = System.currentTimeMillis() - startTime;
            long durationInSeconds = durationInMilliseconds / 1000;

            return durationInSeconds + " s";
        }
    };

    SwingUtilities.invokeLater(weightCalulation);
}

From source file:de.evaluationtool.gui.EvaluationFrameActionListener.java

private ReferenceFormat formatChooser(Collection<ReferenceFormat> formats) {
    ReferenceFormat[] formatsArray = formats.toArray(new ReferenceFormat[0]);
    String[] options = new String[formats.size()];
    for (int i = 0; i < formats.size(); i++) {
        options[i] = formatsArray[i].getDescription();
    }/*from   w ww.j a  va2  s .co  m*/
    int result = JOptionPane.showOptionDialog(frame, "Please choose a reference format.",
            "Choose a reference format", JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null,
            options, options[0]);
    if (result == JOptionPane.CLOSED_OPTION)
        return null;
    return formatsArray[result];
}

From source file:userinterface.EnvironmentRole.PollutionCheckJPanel.java

private void btnSetFineActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSetFineActionPerformed
    int selectedRow = tableCarOwners.getSelectedRow();
    if (selectedRow < 0) {
        JOptionPane.showMessageDialog(null, "Please select a row from the table first", "Warning",
                JOptionPane.WARNING_MESSAGE);
        return;//from  w  w w.  j  a v  a2 s  .  c  om
    } else {
        WorkRequest workRequest = (WorkRequest) tableCarOwners.getValueAt(selectedRow, 3);
        try {
            int oldFine = ((EnvironmentWorkRequest) workRequest).getFine();
            ((EnvironmentWorkRequest) workRequest).setFine(oldFine + Integer.parseInt(textFine.getText()));

            //            ArrayList<Employee,int> sdfdsf;

            Fine fine = new Fine();
            Date date = new Date();
            fine.setDate(date);
            fine.setFineIncurred(Integer.parseInt(textFine.getText()));
            fine.setUserAccount(((EnvironmentWorkRequest) workRequest).getSender());

            environmentOrganization.getFineHistory().getFineIncurredhistory().add(fine);

            JOptionPane.showMessageDialog(null, "FIne Charged", "Success", JOptionPane.INFORMATION_MESSAGE);
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, "Enter a valid number", "Erroe", JOptionPane.ERROR_MESSAGE);
        }

    }

}

From source file:io.heming.accountbook.ui.MainFrame.java

private void exportRecords() {
    final JFileChooser chooser = new JFileChooser();
    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    chooser.addChoosableFileFilter(new AbbFileFilter());
    chooser.setAcceptAllFileFilterUsed(false);
    int value = chooser.showSaveDialog(this);
    if (value == JFileChooser.APPROVE_OPTION) {
        final File file = chooser.getSelectedFile();
        disableAllControls();/*from w  ww. j  a  v  a 2s. c  o  m*/
        new Thread() {
            @Override
            public void run() {
                try {
                    statusLabel.setIcon(new ImageIcon(getClass().getResource("loader.gif")));
                    setStatusText("?...");
                    FacadeUtil.shutdown();
                    // .abb?
                    setStatusText("?...");
                    List<String> exclusion = Arrays.asList();
                    if (!file.getName().endsWith(".abb")) {
                        ZIPUtil.compress(new File(Constants.DATA_DIR),
                                new File(file.getAbsolutePath() + ".abb"), exclusion);
                    } else {
                        ZIPUtil.compress(new File(Constants.DATA_DIR), file, exclusion);
                    }
                    setStatusText("??...");
                    FacadeUtil.restart();
                    enableAllControls();
                    setStatusText("");
                    statusLabel.setIcon(new ImageIcon(getClass().getResource("stopped-loader.png")));
                    JOptionPane.showMessageDialog(MainFrame.this, String.format("?"), "?",
                            JOptionPane.INFORMATION_MESSAGE);
                } catch (IOException e) {
                    JOptionPane.showMessageDialog(MainFrame.this, String.format(""), "",
                            JOptionPane.ERROR_MESSAGE);
                }
            }
        }.start();
    }
}

From source file:fxts.stations.transport.tradingapi.TradingServerSession.java

/**
 * Get User Objects/*from   w  w  w.  j av a 2 s . co  m*/
 *
 * @throws Exception aex
 */
public void getUserObjects() throws Exception {
    GATEWAY.requestTradingSessionStatus();
    beginProcessing();

    String value = mTradingSessionStatus.getParameterValue("FORCE_PASSWORD_CHANGE");
    if (value != null && "Y".equalsIgnoreCase(value)) {
        TradeApp tradeApp = TradeApp.getInst();
        String msg = "For your security, you are required to change your password.";
        String title = tradeApp.getResourceManager().getString("IDS_MAINFRAME_SHORT_TITLE");
        JOptionPane.showMessageDialog(tradeApp.getMainFrame(), msg, title, JOptionPane.INFORMATION_MESSAGE);
        ChangePasswordDialog dialog = new ChangePasswordDialog(tradeApp.getMainFrame());
        if (dialog.showModal() == JOptionPane.OK_OPTION) {
            ChangePasswordRequest cpr = new ChangePasswordRequest();
            cpr.setOldPassword(dialog.getOldPassword());
            cpr.setNewPassword(dialog.getNewPassword());
            cpr.setConfirmNewPassword(dialog.getConfirmNewPassword());
            cpr.doIt();
        } else {
            throw new GenericException("");
        }
    }

    Enumeration<TradingSecurity> securities = (Enumeration<TradingSecurity>) mTradingSessionStatus
            .getSecurities();
    MarketDataRequest mdr = new MarketDataRequest();
    mdr.setSubscriptionRequestType(SubscriptionRequestTypeFactory.SUBSCRIBE);
    mdr.setMDEntryTypeSet(MarketDataRequest.MDENTRYTYPESET_BIDASK);
    while (securities.hasMoreElements()) {
        TradingSecurity ts = securities.nextElement();
        if (ts.getFXCMSubscriptionStatus() == null
                || IFixDefs.FXCMSUBSCRIPTIONSTATUS_SUBSCRIBE.equals(ts.getFXCMSubscriptionStatus())) {
            mdr.addRelatedSymbol(ts);
        }
    }
    mRequestID = GATEWAY.sendMessage(mdr);
    mLogger.debug("mMarketDataRequestID = " + mRequestID);
    setWaitDialogText(mResMan.getString("IDS_GETTING_OFFERS"));
    beginProcessing();

    mRequestID = GATEWAY.requestAccounts();
    mLogger.debug("mAccountMassID = " + mRequestID);
    setWaitDialogText(mResMan.getString("IDS_GETTING_ACCOUNTS"));
    beginProcessing();

    mRequestID = GATEWAY.requestOpenPositions();
    mLogger.debug("mOpenPositionMassID = " + mRequestID);
    setWaitDialogText(mResMan.getString("IDS_GETTING_OPEN_POSITIONS"));
    beginProcessing();

    mRequestID = GATEWAY.requestOpenOrders();
    mLogger.debug("mOpenOrderMassID = " + mRequestID);
    setWaitDialogText(mResMan.getString("IDS_GETTING_OPEN_ORDERS"));
    beginProcessing();

    mRequestID = GATEWAY.requestClosedPositions();
    mLogger.debug("mClosedPositionMassID = " + mRequestID);
    setWaitDialogText(mResMan.getString("IDS_GETTING_CLOSED_POSITIONS"));
    beginProcessing();
}

From source file:javaresturentdesktopclient.AddFoodItemPage.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    // int item=((JComboBox)evt.getSource()).getSelectedIndex();

    Integer foodItem = 0;//from w w  w  . ja  va  2s  .  c om

    ServletRequest.setServletRequest(Constant.FOOD_LIST_SERVLET);
    if (item == 1)//for getting the last food_item_no of that category
    {

        List<NameValuePair> paramList = new ArrayList<>();

        paramList.add(new BasicNameValuePair(Constant.KEY_COMMAND, Constant.KEY_FIND_FOOD_NO));
        paramList.add(new BasicNameValuePair(Constant.KEY_CATEGORY, Constant.CHINEESE));
        System.out.println("Hello chinese!");
        String response = HttpClientUtil.postRequest(paramList);
        System.out.println("Hello login!" + response);
        foodItem = Integer.parseInt(response) + 1;
        System.out.println("Hello new foodno!" + foodItem);
        //getting category_id

    } else if (item == 2) {

        List<NameValuePair> paramList = new ArrayList<>();

        paramList.add(new BasicNameValuePair(Constant.KEY_COMMAND, Constant.KEY_FIND_FOOD_NO));
        paramList.add(new BasicNameValuePair(Constant.KEY_CATEGORY, Constant.BANGLA));
        String response = HttpClientUtil.postRequest(paramList);
        foodItem = Integer.parseInt(response) + 1;

    } else if (item == 3) {

        List<NameValuePair> paramList = new ArrayList<>();

        paramList.add(new BasicNameValuePair(Constant.KEY_COMMAND, Constant.KEY_FIND_FOOD_NO));
        paramList.add(new BasicNameValuePair(Constant.KEY_CATEGORY, Constant.INDIAN));
        String response = HttpClientUtil.postRequest(paramList);

        foodItem = Integer.parseInt(response) + 1;
        System.out.println(" notjinhg" + foodItem);
    } else {
        System.out.println(" notjinhg");
    }
    String foodName = jTextFieldFoodName.getText();//get food_name
    String price = jTextFieldPrice.getText();//get the price
    String foodItemNo;
    foodItemNo = Integer.toString(foodItem);
    List<NameValuePair> paramList = new ArrayList<>();

    paramList.add(new BasicNameValuePair(Constant.KEY_COMMAND, Constant.KEY_FOOD_ADD));
    paramList.add(new BasicNameValuePair(Constant.KEY_FOOD_ITEM, foodItemNo));
    paramList.add(new BasicNameValuePair(Constant.KEY_FOOD_NAME, foodName));
    paramList.add(new BasicNameValuePair(Constant.KEY_PRICE, price));
    paramList.add(new BasicNameValuePair(Constant.KEY_CATAGROY_ID, CategoryId));
    System.out.println("Adding  new food!");

    String response = HttpClientUtil.postRequest(paramList);
    if (response.equalsIgnoreCase("success")) {

        JOptionPane.showMessageDialog(null, "SUCCESSFULLY ADDED", "Information",
                JOptionPane.INFORMATION_MESSAGE);
        jTextFieldFoodName.setText(null);
        jTextFieldPrice.setText(null);
        ShowFoodTable(CategoryId);
    } else {
        JOptionPane.showMessageDialog(null, "Failed please enter valid number in price field!", "Error Message",
                JOptionPane.ERROR_MESSAGE);
    }

}

From source file:burlov.ultracipher.swing.SwingGuiApplication.java

private void showInfo(String string) {
    JOptionPane.showMessageDialog(getMainFrame(), string, "", JOptionPane.INFORMATION_MESSAGE);
}

From source file:io.github.tavernaextras.biocatalogue.integration.config.BioCataloguePluginConfigurationPanel.java

/**
 * Saves recent changes to the configuration parameter map.
 * Some input validation is performed as well.
 */// w  w  w. j av  a2  s  .c om
private void applyChanges() {
    // --- BioCatalogue BASE URL ---

    String candidateBaseURL = tfBioCatalogueAPIBaseURL.getText();
    if (candidateBaseURL.length() == 0) {
        JOptionPane.showMessageDialog(this, "Service Catalogue base URL must not be blank",
                "Service Catalogue Configuration", JOptionPane.WARNING_MESSAGE);
        tfBioCatalogueAPIBaseURL.requestFocusInWindow();
        return;
    } else {
        try {
            new URL(candidateBaseURL);
        } catch (MalformedURLException e) {
            JOptionPane.showMessageDialog(this,
                    "Currently set Service Catalogue instance URL is not valid\n."
                            + "Please check the URL and try again.",
                    "Service Catalogue Configuration", JOptionPane.WARNING_MESSAGE);
            tfBioCatalogueAPIBaseURL.selectAll();
            tfBioCatalogueAPIBaseURL.requestFocusInWindow();
            return;
        }

        // check if the base URL has changed from the last saved state
        if (!candidateBaseURL.equals(
                configuration.getProperty(BioCataloguePluginConfiguration.SERVICE_CATALOGUE_BASE_URL))) {
            // Perform various checks on the new URL

            // Do a GET with "Accept" header set to "application/xml"
            // We are expecting a 200 OK and an XML doc in return that
            // contains the BioCataogue version number element.
            DefaultHttpClient httpClient = new DefaultHttpClient();

            // Set the proxy settings, if any
            if (System.getProperty(PROXY_HOST) != null && !System.getProperty(PROXY_HOST).equals("")) {
                // Instruct HttpClient to use the standard
                // JRE proxy selector to obtain proxy information
                ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(
                        httpClient.getConnectionManager().getSchemeRegistry(), ProxySelector.getDefault());
                httpClient.setRoutePlanner(routePlanner);
                // Do we need to authenticate the user to the proxy?
                if (System.getProperty(PROXY_USERNAME) != null
                        && !System.getProperty(PROXY_USERNAME).equals("")) {
                    // Add the proxy username and password to the list of credentials
                    httpClient.getCredentialsProvider().setCredentials(
                            new AuthScope(System.getProperty(PROXY_HOST),
                                    Integer.parseInt(System.getProperty(PROXY_PORT))),
                            new UsernamePasswordCredentials(System.getProperty(PROXY_USERNAME),
                                    System.getProperty(PROXY_PASSWORD)));
                }
            }

            HttpGet httpGet = new HttpGet(candidateBaseURL);
            httpGet.setHeader("Accept", APPLICATION_XML_MIME_TYPE);

            // Execute the request
            HttpContext localContext = new BasicHttpContext();
            HttpResponse httpResponse;
            try {
                httpResponse = httpClient.execute(httpGet, localContext);
            } catch (Exception ex1) {
                logger.error(
                        "Service Catalogue preferences configuration: Failed to do " + httpGet.getRequestLine(),
                        ex1);
                // Warn the user
                JOptionPane.showMessageDialog(this,
                        "Failed to connect to the URL of the Service Catalogue instance.\n"
                                + "Please check the URL and try again.",
                        "Service Catalogue Configuration", JOptionPane.INFORMATION_MESSAGE);

                // Release resource
                httpClient.getConnectionManager().shutdown();

                tfBioCatalogueAPIBaseURL.requestFocusInWindow();
                return;
            }

            if (httpResponse.getStatusLine().getStatusCode() == HttpURLConnection.HTTP_OK) { // HTTP/1.1 200 OK
                HttpEntity httpEntity = httpResponse.getEntity();
                String contentType = httpEntity.getContentType().getValue().toLowerCase().trim();
                logger.info(
                        "Service Catalogue preferences configuration: Got 200 OK when testing the Service Catalogue instance by doing "
                                + httpResponse.getStatusLine() + ". Content type of response " + contentType);
                if (contentType.startsWith(APPLICATION_XML_MIME_TYPE)) {
                    String value = null;
                    Document doc = null;
                    try {
                        value = readResponseBodyAsString(httpEntity).trim();
                        // Try to read this string into an XML document
                        SAXBuilder builder = new SAXBuilder();
                        byte[] bytes = value.getBytes("UTF-8");
                        doc = builder.build(new ByteArrayInputStream(bytes));
                    } catch (Exception ex2) {
                        logger.error(
                                "Service Catalogue preferences configuration: Failed to build an XML document from the response.",
                                ex2);
                        // Warn the user
                        JOptionPane.showMessageDialog(this,
                                "Failed to get the expected response body when testing the Service Catalogue instance.\n"
                                        + "The URL is probably wrong. Please check it and try again.",
                                "Service Catalogue Configuration", JOptionPane.INFORMATION_MESSAGE);
                        tfBioCatalogueAPIBaseURL.requestFocusInWindow();
                        return;
                    } finally {
                        // Release resource
                        httpClient.getConnectionManager().shutdown();
                    }
                    // Get the version element from the XML document
                    Attribute apiVersionAttribute = doc.getRootElement().getAttribute(API_VERSION);
                    if (apiVersionAttribute != null) {
                        String apiVersion = apiVersionAttribute.getValue();
                        String versions[] = apiVersion.split("[.]");
                        String majorVersion = versions[0];
                        String minorVersion = versions[1];
                        try {
                            //String patchVersion = versions[2]; // we are not comparing the patch versions
                            String supportedMajorVersion = MIN_SUPPORTED_BIOCATALOGUE_API_VERSION[0];
                            String supportedMinorVersion = MIN_SUPPORTED_BIOCATALOGUE_API_VERSION[1];
                            Integer iSupportedMajorVersion = Integer.parseInt(supportedMajorVersion);
                            Integer iMajorVersion = Integer.parseInt(majorVersion);
                            Integer iSupportedMinorVersion = Integer.parseInt(supportedMinorVersion);
                            Integer iMinorVersion = Integer.parseInt(minorVersion);
                            if (!(iSupportedMajorVersion == iMajorVersion
                                    && iSupportedMinorVersion <= iMinorVersion)) {
                                // Warn the user
                                JOptionPane.showMessageDialog(this,
                                        "The version of the Service Catalogue instance you are trying to connect to is not supported.\n"
                                                + "Please change the URL and try again.",
                                        "Service Catalogue Configuration", JOptionPane.INFORMATION_MESSAGE);
                                tfBioCatalogueAPIBaseURL.requestFocusInWindow();
                                return;
                            }
                        } catch (Exception e) {
                            logger.error(e);
                        }
                    } // if null - we'll try to do our best to connect to BioCatalogue anyway
                } else {
                    logger.error(
                            "Service Catalogue preferences configuration: Failed to get the expected response content type when testing the Service Catalogue instance. "
                                    + httpGet.getRequestLine() + " returned content type '" + contentType
                                    + "'; expected response content type is 'application/xml'.");
                    // Warn the user
                    JOptionPane.showMessageDialog(this,
                            "Failed to get the expected response content type when testing the Service Catalogue instance.\n"
                                    + "The URL is probably wrong. Please check it and try again.",
                            "Service Catalogue Plugin", JOptionPane.INFORMATION_MESSAGE);
                    tfBioCatalogueAPIBaseURL.requestFocusInWindow();
                    return;
                }
            } else {
                logger.error(
                        "Service Catalogue preferences configuration: Failed to get the expected response status code when testing the Service Catalogue instance. "
                                + httpGet.getRequestLine() + " returned the status code "
                                + httpResponse.getStatusLine().getStatusCode()
                                + "; expected status code is 200 OK.");
                // Warn the user
                JOptionPane.showMessageDialog(this,
                        "Failed to get the expected response status code when testing the Service Catalogue instance.\n"
                                + "The URL is probably wrong. Please check it and try again.",
                        "Service Catalogue Configuration", JOptionPane.INFORMATION_MESSAGE);
                tfBioCatalogueAPIBaseURL.requestFocusInWindow();
                return;
            }

            // Warn the user of the changes in the BioCatalogue base URL
            JOptionPane.showMessageDialog(this,
                    "You have updated the Service Catalogue base URL.\n"
                            + "This does not take effect until you restart Taverna.",
                    "Service catalogue Configuration", JOptionPane.INFORMATION_MESSAGE);

        }

        // the new base URL seems to be valid - can save it into config
        // settings
        configuration.setProperty(BioCataloguePluginConfiguration.SERVICE_CATALOGUE_BASE_URL, candidateBaseURL);

        /*         // also update the base URL in the BioCatalogueClient
                 BioCatalogueClient.getInstance()
                       .setBaseURL(candidateBaseURL);*/
    }

}

From source file:utybo.easypastebin.windows.MainWindow.java

/**
 * Creates the window//  www. j a  va  2s.  co  m
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public MainWindow() {
    EasyPastebin.LOGGER.log("Initializing the window", SinkJLevel.INFO);
    setTitle("EasyPastebin");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 664, 431);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    contentPane.setLayout(new BorderLayout(0, 0));
    setContentPane(contentPane);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    contentPane.add(tabbedPane, BorderLayout.CENTER);

    JPanel main = new JPanel();
    tabbedPane.addTab("EasyPastebin", null, main, null);
    main.setLayout(null);

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(62, 39, 312, 132);
    main.add(scrollPane);

    pasteContent = new JTextArea();
    pasteContent.setFont(new Font("Monospaced", Font.PLAIN, 11));
    pasteContent.setWrapStyleWord(true);
    pasteContent.setLineWrap(true);
    pasteContent.setToolTipText("Put your paste here!");
    scrollPane.setViewportView(pasteContent);

    JLabel titleLabel = new JLabel("Title :");
    titleLabel.setFont(new Font("Tahoma", Font.PLAIN, 12));
    titleLabel.setBounds(10, 11, 42, 21);
    main.add(titleLabel);

    pasteTitle = new JTextField();
    pasteTitle.setBounds(62, 12, 312, 20);
    main.add(pasteTitle);
    pasteTitle.setColumns(10);

    JLabel lblPaste = new JLabel("Paste :");
    lblPaste.setForeground(Color.RED);
    lblPaste.setFont(new Font("Tahoma", Font.PLAIN, 12));
    lblPaste.setBounds(10, 85, 53, 21);
    main.add(lblPaste);

    pasteExpireDate = new JComboBox();
    pasteExpireDate.setFont(new Font("Tahoma", Font.PLAIN, 12));
    pasteExpireDate.setModel(new DefaultComboBoxModel(EnumExpireDate.values()));
    pasteExpireDate.setBounds(468, 12, 155, 21);
    main.add(pasteExpireDate);

    JLabel lblExpireDate = new JLabel("Expire Date :");
    lblExpireDate.setFont(new Font("Tahoma", Font.PLAIN, 12));
    lblExpireDate.setBounds(384, 14, 81, 14);
    main.add(lblExpireDate);

    JLabel lblfieldsInRed = new JLabel("(Fields in red are required)");
    lblfieldsInRed.setBounds(72, 182, 302, 14);
    main.add(lblfieldsInRed);

    btnSubmit = new JButton("Submit!");
    btnSubmit.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            EasyPastebin.LOGGER.log("Starting Submit script", SinkJLevel.INFO);
            btnSubmit.setEnabled(false);
            btnSubmit.setText("Please wait...");

            boolean success = true;
            String paste = pasteContent.getText();
            String title = pasteTitle.getText();
            EnumExpireDate expireDate = (EnumExpireDate) pasteExpireDate.getSelectedItem();

            if (paste.equals("") || paste.equals(" ") || paste.equals(null)) {
                pastebinUrl.setText("ERROR");
                JOptionPane.showMessageDialog(null, "You cannot send empty pastes!",
                        "Error while processing paste", JOptionPane.ERROR_MESSAGE);
            } else {
                try {
                    EasyPastebin.LOGGER.log("Setting options", SinkJLevel.INFO);
                    Map map = new HashMap<String, String>();
                    map.put("api_dev_key", HttpHelper.API_KEY);
                    map.put("api_option", "paste");
                    map.put("api_paste_code", paste);
                    if (!(expireDate.equals(null) || expireDate.equals(EnumExpireDate.NEVER)))
                        map.put("api_paste_expire_date", expireDate.getRawName());
                    if (!(title.equals("") || title.equals(" ") || title.equals(null)))
                        map.put("api_paste_name", title);

                    EasyPastebin.LOGGER.log("Sending paste", SinkJLevel.INFO);
                    String actionResult = HttpHelper.sendPost("http://pastebin.com/api/api_post.php", map)
                            .asString();
                    EasyPastebin.LOGGER.log("Paste sent, checking output", SinkJLevel.INFO);
                    // Exception handlers
                    if (actionResult.equals("Bad API request, invalid api_option")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null,
                                "Error while processing paste. Incorrect Pastebin option!", "Error",
                                JOptionPane.ERROR_MESSAGE);
                    }
                    if (actionResult.equals("Bad API request, invalid api_dev_key")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null,
                                "Error while processing paste. Incorrect dev key! Try again with a more recent version!",
                                "Error", JOptionPane.ERROR_MESSAGE);
                    }
                    if (actionResult.equals("Bad API request, IP blocked")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null, "Error while processing paste. Your IP is blocked!",
                                "Error", JOptionPane.ERROR_MESSAGE);
                    }
                    if (actionResult.equals(
                            "Bad API request, maximum number of 25 unlisted pastes for your free account")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                    }
                    if (actionResult.equals(
                            "Bad API request, maximum number of 10 private pastes for your free account")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                    }
                    if (actionResult.equals("Bad API request, api_paste_code was empty")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                    }
                    if (actionResult.equals("Bad API request, maximum paste file size exceeded")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null,
                                "Error while processing paste. Your paste is too big!", "Error",
                                JOptionPane.ERROR_MESSAGE);
                    }
                    if (actionResult.equals("Bad API request, invalid api_expire_date")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null,
                                "Error while processing paste. Invalid expire date!", "Error",
                                JOptionPane.ERROR_MESSAGE);
                    }
                    if (actionResult.equals("Bad API request, invalid api_paste_private")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null,
                                "Error while processing paste. Invalid privacy value!", "Error",
                                JOptionPane.ERROR_MESSAGE);
                    }
                    if (actionResult.equals("Bad API request, invalid api_paste_format")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null, "Error while processing paste. Invalid format!",
                                "Error", JOptionPane.ERROR_MESSAGE);
                    }
                    // END

                    // Starting display stuff
                    if (success == false) {
                        EasyPastebin.LOGGER.log("Submit script failed : success == false", SinkJLevel.ERROR);
                        pastebinUrl.setText("ERROR");
                    }
                    if (success == true) {
                        EasyPastebin.LOGGER.log("Paste sent! Starting display script!", SinkJLevel.INFO);
                        pastebinUrl.setText(actionResult);
                        JOptionPane.showMessageDialog(null, "Paste successfully sent!", "Done!",
                                JOptionPane.INFORMATION_MESSAGE);
                        EasyPastebin.LOGGER.log("Display script finished! Paste URL is : " + actionResult,
                                SinkJLevel.INFO);
                    }

                } catch (ClientProtocolException e) {
                    EasyPastebin.LOGGER.log("Unexpected error! " + e, SinkJLevel.ERROR);
                    JOptionPane.showMessageDialog(null, "Error while processing paste : " + e, "Error",
                            JOptionPane.ERROR_MESSAGE);
                    e.printStackTrace();
                } catch (IOException e) {
                    EasyPastebin.LOGGER.log("Unexpected error! " + e, SinkJLevel.ERROR);
                    JOptionPane.showMessageDialog(null, "Error while processing paste : " + e, "Error",
                            JOptionPane.ERROR_MESSAGE);
                    e.printStackTrace();
                } catch (MissingParamException e) {
                    EasyPastebin.LOGGER.log("Unexpected error! " + e, SinkJLevel.ERROR);
                    JOptionPane.showMessageDialog(null, "Error while processing paste : " + e
                            + "! This is a severe programming error! Try again with a more recent version!",
                            "Error", JOptionPane.ERROR_MESSAGE);
                    e.printStackTrace();
                }
            }

            EasyPastebin.LOGGER.log("Re-enabling the Submit button ", SinkJLevel.INFO);
            btnSubmit.setEnabled(true);
            btnSubmit.setText("Submit another paste!");
            EasyPastebin.LOGGER.log("Finished submit script! Success : " + success, SinkJLevel.INFO);
        }
    });
    btnSubmit.setBounds(386, 45, 237, 44);
    main.add(btnSubmit);

    pastebinUrl = new JTextField();
    pastebinUrl.setText("The paste's URL will be shown here!");
    pastebinUrl.setEditable(false);
    pastebinUrl.setBounds(384, 198, 239, 32);
    main.add(pastebinUrl);
    pastebinUrl.setColumns(10);

    JPanel about = new JPanel();
    tabbedPane.addTab("About", null, about, null);

    JLabel label = new JLabel("EasyPastebin");
    label.setBounds(12, 12, 623, 39);
    label.setHorizontalAlignment(SwingConstants.CENTER);
    label.setFont(new Font("Dialog", Font.PLAIN, 25));

    JLabel lblTheEasiestWay = new JLabel("The easiest way to use Pastebin.com");
    lblTheEasiestWay.setBounds(12, 63, 623, 32);
    lblTheEasiestWay.setFont(new Font("Dialog", Font.PLAIN, 16));
    lblTheEasiestWay.setHorizontalAlignment(SwingConstants.CENTER);
    about.setLayout(null);
    about.add(label);
    about.add(lblTheEasiestWay);

    JButton btnForkM = new JButton("Fork me on Github!");
    btnForkM.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            goToUrl("https://github.com/utybo/EasyPastebin");
        }
    });
    btnForkM.setBounds(12, 117, 623, 25);
    about.add(btnForkM);

    JButton btnCheckOutUtybos = new JButton("Check out utybo's projects!");
    btnCheckOutUtybos.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            goToUrl("http://utybo.github.io/");
        }
    });
    btnCheckOutUtybos.setBounds(12, 154, 623, 25);
    about.add(btnCheckOutUtybos);

    JButton btnGoToPastebincom = new JButton("Go to Pastebin.com!");
    btnGoToPastebincom.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            goToUrl("http://www.pastebin.com");
        }
    });
    btnGoToPastebincom.setBounds(12, 191, 623, 25);
    about.add(btnGoToPastebincom);

    JLabel lblcUtybo = new JLabel(
            "This soft was made by utybo. It uses Apache's libraries for the interaction with Pastebin's API");
    lblcUtybo.setFont(new Font("Dialog", Font.PLAIN, 10));
    lblcUtybo.setHorizontalAlignment(SwingConstants.CENTER);
    lblcUtybo.setBounds(12, 324, 623, 15);
    about.add(lblcUtybo);

    JLabel lblClickMeTo = new JLabel("Click me to go to Apache's licence official website");
    lblClickMeTo.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            goToUrl("http://www.apache.org/licenses/LICENSE-2.0");
        }
    });
    lblClickMeTo.setHorizontalAlignment(SwingConstants.CENTER);
    lblClickMeTo.setFont(new Font("Dialog", Font.PLAIN, 10));
    lblClickMeTo.setBounds(12, 342, 623, 15);
    about.add(lblClickMeTo);

    setVisible(true);

    EasyPastebin.LOGGER.log("Done!", SinkJLevel.INFO);
}