以前はJava Swingで作業していましたが、今はJavaFXで作業しようとしています。私のJava Swingコードの最後の時間:JavaFXでTabPaneからタブを実際に隠す方法
//These line of code is to call method that declared in ContentPage.java
contentPage.adminFeatureEnabled(adminEnabled);
contentPage.managerFeatureEnabled(managerEnabled);
と私のContentPage.java
//By default, all feature (or tab) are enabled.
//This method is to remove register account if the user login into the system is manager and staff
public void adminFeatureEnabled(boolean a) {
if (!a) {
tabPane.removeTabAt(tabPane.indexOfComponent(registerAccount));
}
}
//This method is to remove register account and purchase order if the user who log into the system is staff
public void managerFeatureEnabled(boolean a) {
if(!a) {
tabPane.removeTabAt(tabPane.indexOfComponent(purchaseOrder));
}
}
と私のコード内で:
if (role.equals("admin")){
contentPage.contentFrame.setTitle("Menu - Admin!");
contentPage.disUser.setEditable(true);
contentPage.chgRoles.setEnabled(true);
} else if(role.equals("manager")){
contentPage.contentFrame.setTitle("Menu - Manager!");
contentPage.chgRoles.setSelectedItem("manager");
adminEnabled = false;
}else if (role.equals("staff")){
contentPage.contentFrame.setTitle("Menu - Staff!");
contentPage.chgRoles.setSelectedItem("staff");
adminEnabled = false;
managerEnabled = false;
}
上記のコードは次のように実行します。
- ユーザーが管理者アカウントでログインすると、すべての機能
私はJavaFXのでは上記と同じ機能を望んでいたが、私は知らない:(タブ)マネージャとして - ときに、ユーザのログインを有効にし、いくつかの機能(タブ)が今
私の現在の問題を非表示になります方法のどれも私が望むように働かないように。
誰もが私を助けることができますか?
関連(いないタブの特定が):[JavaFXの上で「レンダリング」などのプロパティを実装する方法はありますか?](http://stackoverflow.com/questions/19666982/is-there-a- way-to-implement-a-property-like-rendered-javafx)を使用します。 – jewelsea