WizardPane:禁用屏幕上的“上一页"按钮 [英] WizardPane : Disable 'Previous' button on a screen
本文介绍了WizardPane:禁用屏幕上的“上一页"按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在ControlsFX WizardPane
的屏幕上禁用上一步"按钮?我正在尝试使用此方法prev.setDisable(true)
,但是我所拥有的是NullPointerException
.
How can I disable the 'Previous' button on my Screen of the ControlsFX WizardPane
? I am trying it with this method prev.setDisable(true)
but what I have is NullPointerException
.
public class MainApp extends Application {
Wizard wizard = new Wizard();
WizardPane1 page1 = new WizardPane1();
WizardPane page2 = new WizardPane();
WizardPane page3 = new WizardPane() {
@Override
public void onEnteringPage(Wizard wizard) {
Node prev = lookupButton(ButtonType.PREVIOUS);
prev.setDisable(true);
}
};
page1.setContent(page1.getInit());
wizard.setFlow(new LinearFlow(page1, page2, page3));
wizard.showAndWait();
}
public class WizardPane1 extends WizardPane {
public void initWizard() {}
}
推荐答案
这将禁用该按钮.
@Override
public void onEnteringPage( Wizard wizard ) {
for ( ButtonType type : getButtonTypes() ) {
if ( type.getButtonData().equals(ButtonBar.ButtonData.BACK_PREVIOUS) ){
System.out.println("Found Back button");
previous_button = (Button) lookupButton( type );
break;
}
}
Platform.runLater(new Runnable() {
@Override
public void run() {
previous_button.setDisable(true);
}
});
}
这篇关于WizardPane:禁用屏幕上的“上一页"按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文