title: Converting my Program to JFrame
body: <pre><code>import java.io.*;
  import java.util.Scanner;
  import java.util.Date;
  import java.text.DateFormat;
  import java.text.SimpleDateFormat;
  import java.util.Calendar;
  import java.util.ArrayList;
  import java.util.List;
  import javax.swing.*;
  import java.awt.event.*;
  import java.awt.*;
  
  public class SignIn extends JFrame{
  
  //  public static void setFrame(){
  //    JFrame frame = new JFrame("Test");
  //    frame.setSize(400, 300);  
  //    frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
  //    frame.setLayout(new FlowLayout());
  //    frame.setVisible(true);
  //    
  //    JLabel label = new JLabel("this is a label");
  //    JPanel panel = new JPanel();
  //    
  //    JTextArea textArea = new JTextArea(10,10);
  //    textArea.append("this is an uneditable text area./n balls");
  //    JTextField textField = new JTextField(9);
  //    JButton button = new JButton("Submit");  
  //    frame.add(panel);
  //    panel.add(label);
  //    panel.add(textArea);
  //    panel.add(textField);
  //    panel.add(button);
  //    frame.add(panel);
  //  }
    public static int getIndex(int[] array, int x){
      int index = -1;
      for(int i = 0; i &lt; array.length; i++){
        if(array[i] == x)
          index = i;
      }
      return index;
    }
  
    public static void main(String[] args) throws Exception { 
      int i;
      String w;
      Scanner keyboard = new Scanner(System.in);
      DateFormat dateFormat = new SimpleDateFormat("MM_dd_yyyy");
      Date date = new Date();
      File file = new File("Attendance/" + (dateFormat.format(date) + "_Attendance.txt"));
      File numfile = new File("DataBase/Student Number DataBase.txt");
      File namfile = new File("DataBase/Student Name DataBase.txt");
      file.getParentFile().mkdirs();
      PrintWriter info = new PrintWriter(file);
      PrintWriter numdata = new PrintWriter(new FileWriter(numfile,true));
      PrintWriter namdata = new PrintWriter(new FileWriter(namfile,true));
  
  
      Scanner sc = new Scanner(namfile);
      List&lt;String&gt; lines = new ArrayList&lt;String&gt;();
      while (sc.hasNextLine()) {
        lines.add(sc.nextLine());
      }
      String[] namedatabase = lines.toArray(new String[150]);
  
      Scanner scc = new Scanner(numfile);
      List&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;();
      while (scc.hasNextInt()) {
        numbers.add(scc.nextInt());
      }
      int[] numberdatabase = new int[150];
      for(int p=0, len = numbers.size(); p &lt; len; p++){
      numberdatabase[p] = numbers.get(p);
      }
      setFrame();
      while(true){
        System.out.println("");
        System.out.print("Write your Student ID: ");
        int id = keyboard.nextInt();
        String idstring = Integer.toString(id);
        if(id == 000)break;
        while(idstring.length() != 9){
          System.out.println("");
          System.out.print("Invalid Student ID, retype it: ");
          id = keyboard.nextInt();
          idstring = Integer.toString(id);
        }
        while(getIndex(numberdatabase, id) == -1){
          System.out.println("");
          System.out.print("Is your Student Number " + id + "?(yes or no): ");
          keyboard.nextLine();
          w = keyboard.nextLine();
          if(w.equals("yes")){     
            for(i = 0; i &lt; numberdatabase.length; i++){
              if(numberdatabase[i] == 0) break;
            }
            numberdatabase[i] = id;
            numdata.println(id);
            System.out.println("");
            System.out.print("Write your FIRST AND LAST name: ");
            namedatabase[i] = keyboard.nextLine();
            namdata.println(namedatabase[i]);
          }
          else{
            System.out.println("");
            System.out.print("Retype your Student ID: ");
            id = keyboard.nextInt();
            idstring = Integer.toString(id);
            while(idstring.length() != 9){
              System.out.println("");
              System.out.print("Invalid Student ID, retype it: ");
              id = keyboard.nextInt();
              idstring = Integer.toString(id);
            }
          }
        }
  
        DateFormat timeFormat = new SimpleDateFormat("hh:mm a");
        Date time = new Date();
        System.out.println("");
        System.out.println("You logged in at " + timeFormat.format(time) + " as " + namedatabase[getIndex(numberdatabase, id)] + " : " + id); 
        info.print("Student ID: " + id);
        info.print("  Name: " + namedatabase[getIndex(numberdatabase, id)]);
        info.println("  " + timeFormat.format(time));
      } 
      info.close();
      numdata.close();
      namdata.close();
    }
  }
  </code></pre>
  
  <p>Ok So I am trying to convert this program I wrote to a JFrame format. Unfortunately I've never used JFrame so I have no idea what I'm doing. I Got the basics from a tutorial but I just can't seem to put 2 and 2 together. Can someone help me easily implement JFrame to this program? thanks. </p>
  
  <p>PS. I know I should probably start using more methods rather than stick it all in the main method.</p>