Call static content
Peter Penzov
peter.penzov at gmail.com
Sat Aug 24 12:01:58 PDT 2013
I have this code from JavaFX application:
private static final ImageView ncpic;
static {
ncpic = new
ImageView(TabContent.class.getResource("/images/6.jpg").toExternalForm());
}
I noticed that I can use this picture only once. When I use it twice the
scene where I call it it's empty. How I can use this picture twice or more
times? Maybe this is caused by the static java method which I call to
display the picture?
quick example:
public class TabContent {
private static final ImageView ncpic;
static {
ncpic = new
ImageView(TabContent.class.getResource("/images/6.jpg").toExternalForm());
}
private static StackPane generalConfiguration() {
StackPane stack = new StackPane();
stack.getChildren().addAll(ncpic); // Add the picture
and the Label
return stack;
}}
I use it this way: TabContent.generalConfiguration() And second time in
different Java Class.
More information about the openjfx-dev
mailing list