Which JavaFx 2.0 class can cointain different Node implementations like ImageView or MediaView?
Вопрос
The use case is quite simple - I need to create a 'container' which can display (contain) different subtypes of Node
class. I will use this object in my Scene
and switch displayed content on runtime. So when it is displayed first it will contain ImageView
, after animation finishes I want to swich to MediaView
, and so on...
Just think of a JavaScript Slider and you will get what I want :)
The question is - is there any component in JavaFX JDK which will help me achieve what I want? I couldn't find any in documentation reference.
Решение
You may use simple Pane
and change views by:
Pane container = new Pane();
container.getChildren().add(imageView);
...
// event happened
container.getChildren().clear();
container.getChildren().add(mediaView);
Also you can try to use Accordion
control or TabPane
control.
Не связан с StackOverflow