Java 和 Scene Builder 如何禁用和启用选项卡
Java and Scene Builder How to Disable and Enable Tab
我正在使用 NetBeans 和 Scene Builder 构建应用程序。我有一个 TabPane,但是,我希望在单击 btnAnonymousClientClick
时禁用窗格中的第三个选项卡,我该怎么做呢?
我的代码:
public class FXMLDocumentController implements Initializable {
@FXML
private Button btnCreateAnonymousClient;
@FXML
private Button btnCancel;
@FXML
private TextField txtAnonymousClientFirstName;
@FXML
private Label lblFirstName;
@FXML
private Label lbl;
@FXML
private TabPane tabControlPane;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
@FXML
private void btnAnonymousClientClick(ActionEvent event) {
}
@FXML
private void btnAnonymousClientCancel(ActionEvent event) {
}
}
您可以通过向其添加 fx:id 并将其添加到您的代码中来禁用选项卡。
@FXML
private Tab yourTabFXID
yourTabFXID.setDisable(true);
我正在使用 NetBeans 和 Scene Builder 构建应用程序。我有一个 TabPane,但是,我希望在单击 btnAnonymousClientClick
时禁用窗格中的第三个选项卡,我该怎么做呢?
我的代码:
public class FXMLDocumentController implements Initializable {
@FXML
private Button btnCreateAnonymousClient;
@FXML
private Button btnCancel;
@FXML
private TextField txtAnonymousClientFirstName;
@FXML
private Label lblFirstName;
@FXML
private Label lbl;
@FXML
private TabPane tabControlPane;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
@FXML
private void btnAnonymousClientClick(ActionEvent event) {
}
@FXML
private void btnAnonymousClientCancel(ActionEvent event) {
}
}
您可以通过向其添加 fx:id 并将其添加到您的代码中来禁用选项卡。
@FXML
private Tab yourTabFXID
yourTabFXID.setDisable(true);