#SceneBuilder's imageView doesn't display initial image. Only in-code absolute path works

1 messages ยท Page 1 of 1 (latest)

sudden thistle
final ravenBOT
#

<@&987246399047479336> please have a look, thanks.

sudden thistle
#

this is the initial result of running the program

final ravenBOT
#

Here is an AI assisted attempt to answer your question ๐Ÿค–. Maybe it helps! In any case, a human is on the way ๐Ÿ‘. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#

One possible reason why the imageView in Java SceneBuilder may not be displaying the initial image could be due to the way the image path is specified in the FXML file.

When using SceneBuilder, it is important to make sure that the image path is specified correctly in the FXML file. If you are using a relative path to specify the image location, make sure that the image file is located in a directory that is accessible from where your FXML file is located.

If you are still facing issues with displaying the initial image in Java SceneBuilder, you can try specifying an absolute path to the image file directly in your code. This can be done by setting the image property of the imageView object programmatically in your Java code.

Here's an example of how you can set an absolute path for an imageView in Java code:

File file = new File("C:/path/to/your/image.jpg");
Image image = new Image(file.toURI().toString());
imageView.setImage(image);

By setting an absolute path for the image file directly in your Java code, you can ensure that the initial image will be displayed correctly in Java SceneBuilder.

sudden thistle
#

after clicking the button which triggers cycleImage(), this is the result:

#

oh this is what's set in the .fxml file
<image>
<Image url="@../../../../../../../../Pictures/10%20CAT%20PICS/IMG_1434.jpg" />
</image>

#

im gonna try setting the absolute path here because i dont think the "../../../../../../../../Pictures" results in anything

#

womp womp still broken

sudden thistle
#

turns out all my issues were resolved by learning how intellij handles filepaths differently from eclipse, whoops