Which JavaFx 2.0 class can cointain different Node implementations like ImageView or MediaView?

StackOverflow https://stackoverflow.com/questions/9484026

  •  13-11-2019
  •  | 
  •  

문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top