获取JavaFX应用程序Main方法中.fxml文件中定义的TextArea

我想问你,是否可以从start()方法获得在sample.fxml文件中定义的TextArea,在那里我定义了FXMLoader和主阶段。我需要在那里获取TextArea对象,并在其上设置一些我之前保存到文件中的String。

谢谢你们!

<table>
  <tbody>
    <tr>
      <th width="64">8"</th>
      <th width="64">6"</th>
      <th width="64">5"</th>
      <th width="64">4"</th>
      <th width="64">3"</th>
      <th width="74">2"</th>
      <th width="100">inch</th>
    </tr>
    <tr>
      <td rowspan="2">76</td>
      <td rowspan="2">69</td>
      <td rowspan="2">48</td>
      <td rowspan="2">27</td>
      <td rowspan="2">20</td>
      <td rowspan="2">11</td>
      <td rowspan="2" width="100">A</td>
    </tr>
  </tbody>
</table>
<br>
<table>
  <tbody>
    <tr>
      <th rowspan="2" width="110">Status</th>
      <th width="110">time</th>
      <th width="110">power</th>
      <th rowspan="2" width="110">second status</th>
      <th width="110">D</th>
    </tr>
    <tr>
      <th>Time</th>
      <th>( bar )</th>
      <th>D1 </th>
    </tr>
    <tr>
      <td>A</td>
      <td>1</td>
      <td>32</td>
      <td>(B)</td>
      <td>25</td>
    </tr>
  </tbody>
</table>

这是我的.fxml文件

window.crypto.subtle.decrypt(
        {
            name: "RSA-OAEP",hash: { name: "SHA-512" }
            //label: Uint8Array([...]) //optional
        },privateRsaKey,//CryptoKey object containing private RSA key
        encdata //ArrayBuffer containing to be decrypted data
    )
    .catch(function(err){
        console.error(err);
    })

yy54928 回答:获取JavaFX应用程序Main方法中.fxml文件中定义的TextArea

使用forEach循环按ID获取节点,然后将其转换为TextArea

 root.getChildrenUnmodifiable().forEach((node) -> {
        if(node.getId()=="timeInputId"){
        TextArea textArea = (TextArea)node;
        textArea.setText(" your string here ");
        }
    });
本文链接:https://www.f2er.com/2338915.html

大家都在问