NEWS: Total Picture Views: 155283 | Total Article Views: 165627 | Top 5 Most Popular Article: 1. Am I Stuck Algorithm with Becker Robot | 2. PickUpThings with Becker Robot | 3. How to read a JSON and work with it | 4. Encrypted Data GUI (Download .Zip) | 5. Create Wall and Things with Becker

Compare String with Input Box Dialog Java


In this example I will be showing how to use a input box dialog and compare the string with it if it's correct.


import javax.swing.*;

 * Created by Jean-Mathieu on 3/2/2015.
public class Launch {
    public static void main(String []args){
        do {
            String username = JOptionPane.showInputDialog("Enter your username:");
            String password = JOptionPane.showInputDialog("Enter your password:");
            if (username.equals("Sheridan") && password.equals("Sheridan")) {
                JOptionPane.showMessageDialog(null, "You're connected!");
                JOptionPane.showMessageDialog(null, "Wrong Password!");

Attachments: None

Tags: String Compare Dialog Input

Total Views: 877

My name is Jean-Mathieu

I created this website so other people could enjoy finding useful stuff easier. If you have any question do not hesitate to contact me.

jean8mathieuCreated on 03/02/15 and updated on 03/02/15


Disclosure: We are a website that needs compensation to operate like any other website on the internet.
We may receive consideration for our reviews but we are totally unbiased and do not accept paid reviews or fake reviews claiming to be something they are not.