I have one JFrame called User where I declare a variable called id and set it to a certain value depending on some conditions.
I need to use this variable in a second JFrame called output.
This is the code I have
class InputScreen extends javax.swing.JFrame {
public int id = 0;
private void submitButtonActionPerformed(java.awt.event.ActionEvent evt) {                                            
    if (condition){
        id = 1;
        System.out.println(id);
    }
    elseif (condition){
             id = 2;
             System.out.println(id);
    }
    elseif (condition){
             id = 3;
             System.out.println(id);
    }
    else{
    System.exit(0);
    }
I used a constructor in the frame Output but it doesn't seem to work.
public class Output extends javax.swing.JFrame {
int rule;
public Output(int Id){
    rule = Id;
    initComponents();
}
public Output() {
    initComponents();
    conn = MySqlConnect.ConnectDB();
}
Updated Code Frame - Input
class InputScreen extends javax.swing.JFrame {
public int id = 0;
public int getID(){
    return input_rule_id;
}
private void submitButtonActionPerformed(java.awt.event.ActionEvent evt) {                                            
    if (condition){
        id = 1;
        System.out.println(id);
    }
    elseif (condition){
             id = 2;
             System.out.println(id);
    }
    elseif (condition){
             id = 3;
             System.out.println(id);
    }
Form - Output
private void formWindowActivated(java.awt.event.WindowEvent evt)       {                                     
    Input InSc = new Input();
    InSc.getId();
 }
 
     
     
    