title: JAVA 2 classes GUI set text
body: <p>I have a problem with my java UI. So i made my code for adding numbers that works in console but i wanted to port it fully to GUI. I made GUI(second file class named NewJFrame.java) in the netbeans GUI editor, i've set a label and a text field in it. Then I tried to make the output come out in the Label and let the user put input inside the textfield. I found out that i cannot change the text of the label with .setText because the code generated in NetBeans is private. Is there any way i can try to do it differently? Here's the current code i've got and thanks in advance for all the answers!</p>
  
  <pre><code> package pkg1addition;
  import java.util.Scanner;
  
  public class Main {
  
      public static void main(String[] args) {
  
      NewJFrame frame = new NewJFrame();
      frame.setVisible(true);
  
      Scanner input = new Scanner(System.in);
      int number1 = 0;
  
      while (true) {
  
          if (input.hasNext("[0-9]+")) {
              number1 = input.nextInt();
              break;
          } else {
               NewJFrame.outputField.setText("something something");
              //System.out.print("Not a number, try again. ");
              input.next();
          }
  
      }
  
      System.out.print("Enter second integer: ");
  
      int number2 = 0;
      while (true) {
          if (input.hasNext("[0-9]+")) {
              number2 = input.nextInt();
              break;
          } else {
               NewJFrame.outputField.setText("something something");
              //System.out.println("Not a number, try again. ");
              input.next();
          }
  
      }
      int sum = number1 + number2;
      NewJFrame.outputField.setText("something something");
      //System.out.printf("Your sum is: %d%n", sum);
  
  }
  }
  </code></pre>