Skip to content

Instantly share code, notes, and snippets.

@TheItachiUchiha
Created May 10, 2016 09:42
Show Gist options
  • Save TheItachiUchiha/13f8cc637872ebac4385f92cd16075a7 to your computer and use it in GitHub Desktop.
Save TheItachiUchiha/13f8cc637872ebac4385f92cd16075a7 to your computer and use it in GitHub Desktop.
Tests the hide/show property of a MaskerPane
import javafx.application.Application;
import javafx.concurrent.Task;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import org.controlsfx.control.MaskerPane;
public class MaskerPaneTest extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
MaskerPane progressPane = new MaskerPane();
progressPane.setVisible(false);
Button button = new Button("Show");
button.setOnAction(event -> {
Task task = new Task<Void>() {
@Override
protected Void call() throws Exception {
progressPane.setVisible(true);
Thread.sleep(2000);
return null;
}
@Override
protected void succeeded(){
super.succeeded();
progressPane.setVisible(false);
}
};
new Thread(task).start();
});
VBox box = new VBox(button, progressPane);
box.setAlignment(Pos.CENTER);
Scene scene = new Scene(box, 200, 200);
primaryStage.setScene(scene);
primaryStage.show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment