Saturday, August 11, 2012

Setup a Java input Dialog

I was needing a way to change up some of my code so that when I sent out the application I could send it with no license key file and make the user put in the valid key.  This way could have a basic installer and just send the key/keys along with the installer, telling them what to do.  So I found the code below and worked it right in, and everything is just the way I wanted it now.


import javax.swing.JOptionPane;

public class JavaInputDialog
{
public static void main(String[]args)
{
  //Pop up an input box with text ( What is your name ? )
  String a=JOptionPane.showInputDialog(null,"What is your name ?");

  //Print into command prompt what you put into input dialog box
  System.out.println("My name is : "+a);
}
}

* Found this info at http://java2everyone.blogspot.com/2009/01/input-box-in-java.html, I am not trying to take credit for the info just listing it to share the info with other out there that might be looking for it as well.

No comments:

Post a Comment