title: Need Java Help with Combining Multiple Classes in Gui
body: <p>I have prepared 2 classes which perform a function that I would like to wrap up in one nice easy to use GUI.</p>
  
  <p>Here is the first class:</p>
  
  <pre><code>import java.util.Scanner;
  import java.text.*;
  
  public class inputDecimal {
  
      Scanner input = new Scanner( System.in );    
  DecimalFormat  decConv =  new DecimalFormat("00.00");
  
  double dec;
  double remain;
  double remaindb;
  double mindb;
  int deg;
  int min;
  double sec;
  
  System.out.print("Enter the Decimal Coordinate: ");
  dec = input.nextDouble();
  
  deg = (int)dec;
  remain = dec - deg;
  remaindb = remain * 60;
  min = (int)remaindb;
  mindb = remaindb - min;
  sec = mindb * 60;
  
  System.out.printf("Your Coordinate Equals "+deg+"\u00b0"+min+"'"+decConv.format(sec)+"\"\n");
  
  }
  </code></pre>
  
  <p>Here is the second class:</p>
  
  <pre><code>import java.util.Scanner;
  import java.text.*;
  
  class inputDegree {
  
     Scanner input = new Scanner( System.in );            
     DecimalFormat  decConv =  new DecimalFormat("000.000");
  
  double deg;
  double min;
  double sec;
  double degadd;
  double minup;
  double minadd;
  double dec;
  
  System.out.print("Enter the Degrees: ");
  deg = input.nextDouble();
  
  System.out.print("Enter the Minutes: ");
  min = input.nextDouble();
  
  System.out.print("Enter the Seconds: ");
  sec = input.nextDouble();   
  
  degadd = sec / 60;
  minup = degadd + min;
  minadd = minup / 60;
  dec = deg + minadd;
  
  System.out.printf("Your Converted Coordinate Equals "+ decConv.format(dec) +"\n");
  
  
  
   }
  </code></pre>
  
  <p>Okay, so that lays out the 2 main functions that I need to fill.  Now, the piece I am looking to have help with is to create a main class which would call on these two classes as necessary.  Pretty much I just want the gui to present 2 buttons.  One button says "Input Degree" and the other says "Input Decimal."  Then, when the user clicks on one of the buttons it will call the corresponding class and ask for the input.</p>
  
  <p>Thank you for helping me with this issue.  I am new to Java and coding for that matter, so this is really going to help connect some of the pieces of this process that I have been struggling with recently.</p>
  
  <p>================================</p>
  
  <h1>This rest are follow-up comments as this question has developed:</h1>
  
  <p>I have followed along through your answer (Aleksi) and there are a few quick follow-up questions: </p>
  
  <p>(1) In response to the question "are you sure you want a GUI not just a text interface?" My answer is no, I am not sure.  I would like to ultimately create a GPS converter that I can embed on a website.  So, whatever format I can do that with best is what I am after.   </p>
  
  <p>(2) When I try to compile the final code that you provided titled 'AwesomeGUI.java' I get the following errors:</p>
  
  <pre><code>AwesomeGUI.java:137: cannot find symbol
  symbol  : method isEmpty()
  location: class java.lang.String
    if (textField.getText().isEmpty()) {
                         ^
  AwesomeGUI.java:146: method does not override a method from its superclass
  @Override
   ^
  AwesomeGUI.java:161: method does not override a method from its superclass
  @Override
   ^
  3 errors
  </code></pre>
  
  <p>(3)  Otherwise, I was able to compile the program through the stepwise process you provided.
  Really I just want to make a program which asks the user if they would like to convert either a decimal or degree based GPS unit.  Then they click on the appropriate button and they are asked to fill in the form to convert.</p>
  
  <p>I know I am getting a bit too detailed with my needs rather than asking a specific question, but it is my hope that by providing what I ultimately want to have here then you may be able to point me in the right direction.  </p>
  
  <p>Many many thanks to all who have helped me with this.</p>
  
  <p>================================</p>
  
  <h1>Second Follow-Up Round</h1>
  
  <p>I have been trying to upgrade to Java 6 with no luck, so I am stuck with 5.  With that being the case, could you please elaborate on the addition of </p>
  
  <pre><code>java.util.regex.Pattern.matches("^\\s*$", textField.getText());
  </code></pre>
  
  <p>Do I import it at the start of the code?  If so, do I only import on the AwesomeGUI.java class?  </p>
  
  <p>Or, does this code function in a different manner?</p>
  
  <p>many thanks, 
  presto </p>