JavaFX UI won't update
The line getChildren().remove get's executed on the application thread and does remove the child.
But the UI doesn't update/repaint because when I resize my window the selector disappears.
When I run my app with debug the ui properly updates but when I don't run it with debug it doesn't
33 Replies
⌛
This post has been reserved for your question.
Hey @Noah | Nowipi! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
i have no idea
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
Why should it update when resizing?
It should update when i call remove
But it doesn't
It does when you manually update the ui with something like resizing the window
Did you check whether remove is called?
Does the size actually change?
Yes the size changes
And yes remove gets called
It does only seem to happen if the property changes it's value to null
It's a javafx objectproperty btw
Can you try replacing the element by an "empty" element?
instead of just removing it
Not at the moment but I will tomorrow
That would be strange if that would work though
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
this works
putting an empty image at the old place
but that's a hacky solution
Does using that mechanism make any difference? https://stackoverflow.com/a/72322665/10871900
Stack Overflow
In JavaFx, how to remove a specific node from a gridpane with the c...
If I know the specific coordinate of the node I am trying to remove, let's say "col:3, row: 4", how can I remove the node in column 3 and row 4?
Is there a built-in method I can use in Java?
like maybe it doesn't like the
remove()
removeIf doesn't work either
but I found layout()
and layoutChildren()
but they also both don't work
maybe it has something to do with that in the same grid cell there are multiple imageViews
I have an image of a gem and the selector in the same cell
because when I remove all images from the same cell the selector does disappear
but when I only remove the selector the selector does not appear
The SelectorView also isn't a normal ImageView
Do you have a custom add method?
no
Can you show a minimal reproducer?
instead of replacing it with an empty
ImageView
, you could try replacing it with an empty Node
or whateverI can't seem to reproduce it
This works fine although clicks don't always register
Than it has to be something that has to do with it having animations
ig maybe stuff doesn't disappear during animations
If you are using
Timeline
s, you might have the issue of it not being removed: https://dev.java/learn/javafx-animations/#timeline
but I can't do much except guessing if I can't reproduce itI am using Transition
Netopyr GmbH
Creating a Sprite Animation with JavaFX
While most of my posts so far dealt with JavaFX properties and bindings, today I want to write about another part of the JavaFX runtime I also work on: the animation API. In this article I will explai
it's definitely the remove call
but I think it's a JavaFX bug
the grid isn't redrawing because I have another image under it
What do you mean with having another image under it?
What happens if you remove it and add another element at a different position?
The grid is filled with imageviews
Might be interesting to see
than it updates correctly
When you say "under", do you mean "below" or "behind"?
below
oh no
soryy
behind
Does it still happen without the image behind?
btw you could try not removing any
ImageView
s at all but just do yourImageView.setImage(yourNewImage)
I can try
fixed it
I treated ImageView's like they were images and that's not what they are for
Now I treat them as things that display an image and it works
I still think I encountered a JavaFX bug though
but this is a way cleaner solution
ty this helped a lot!
if you can create a minimal reproducer, you could try reporting it
though if you show me before, I could maybe check about it actually being some intentional thing
if you don't want to: you don't have to
also it could be fixed by updating JavaFX
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
Post Closed
This post has been closed by <@270107388244262912>.