title: use multiple button to pass information in one scene in javaFX
body: <p>I have a Controller class called: BatteryBoardSelectionFrame
  and I have a Controller for a javaFX scene called: CellDetailShowScene</p>
  <p>I have 2 buttons named: redBatteryBtn and redBatteryBtn2 in &quot;BatteryBoardSelectionFrame&quot; class that should pass information from this class to &quot;CellDetailShowScene&quot; class.</p>
  <p>I can pass redBatteryBtn information to &quot;CellDetailShowScene&quot; and print the informations perfect, but I don't know how to pass redBatteryBtn2 information to &quot;CellDetailShowScene&quot;</p>
  <p>Every time I run the program, and click on second battery(redBatteryBtn2) it shows just first battery information(redBatteryBtn).</p>
  <p>can you please help me with this?</p>
  <p>The code for BatteryBoardSelectionFrame class is:</p>
  <pre><code>
     public class BatteryBoardSelectionFrame implements Initializable {
  
      @FXML
      private Button redBatteryBtn, redBatteryBtn2;
  
  public int batteryLevel = 3;
  public int batteryLevel2 = 10;
  
  @FXML
      public void openCellDetailShowScene(ActionEvent event) {
          FXMLLoader loader = new FXMLLoader(getClass().getResource(&quot;View/CellDetailShowScene.fxml&quot;));
          if (event.getSource().equals(batteryLevel)) {
              System.out.println(&quot;0&quot;);
              try {
                  Parent root = (Parent) loader.load();
                  CellDetailShowScene cellDetailShowScene = loader.getController();
                  cellDetailShowScene.getCell1Data(batteryLevel);
  
                  Stage stage = new Stage();
                  stage.setScene(new Scene(root));
                  stage.show();
              } catch (Exception e) {
  
              }
          }
          else if(event.getSource().equals(batteryLevel2)){
              System.out.println(&quot;1&quot;);
              try {
                  Parent root = (Parent) loader.load();
                  CellDetailShowScene cellDetailShowScene = loader.getController();
                  cellDetailShowScene.getCell1Data2(batteryLevel2);
  
                  Stage stage = new Stage();
                  stage.setScene(new Scene(root));
                  stage.show();
              } catch (Exception e) {
  
              }
      }
  }
  
   public int getBatteryLevel() {
          return this.batteryLevel;
      }
  
  public int getBatteryLevel2() {
          return this.batteryLevel;
      }
  }
  
  </code></pre>
  <p>and The code for CellDetailShowScene class is:</p>
  <pre><code>
      public class CellDetailShowScene implements Initializable {
      
          @FXML
          private Label chargeLevel;
      
      BatteryBoardSelectionFrame batteryBoardSelectionFrame = new BatteryBoardSelectionFrame();
      
      public void getCell1Data(int batteryLevel) {
          }
      
      public void getCell1Data2(int batteryLevel2) {
          }
  
  @Override
      public void initialize(URL location, ResourceBundle resources) {
          LoginFrame loginFrame= new LoginFrame();
          welcomeUsername.setText(&quot;welcome &quot; + loginFrame.getUsernameField());
  
          int showChargeLevel1= batteryBoardSelectionFrame.getBatteryLevel2();
          int showChargeLevel2= batteryBoardSelectionFrame.getBatteryLevel2();
  
          chargeLevel.setText(String.valueOf(showChargeLevel1 + &quot;%&quot;));
  chargeLevel.setText(String.valueOf(showChargeLevel2 + &quot;%&quot;));
  chargeLevel.setText(String.valueOf(Integer.parseInt(String.valueOf(chargeL))));
  
   public void getCell1Data(int chargeL, int temperatureL, int voltageL, int currentL){
          int showChargeLevel= batteryBoardSelectionFrame.getBatteryLevel();
  }
  
  }
  </code></pre>
  <p>Thank you guys</p>