0

I have a question but maybe it was an old question.

I saw a class that extends JPanel and an override function called paintComponent for updating panel.

I use javafx, so i want to know is there any alternative for paintComponent?

I want to update a scene in my game loop, or when i use setScene for my stage.

Thanks.

  • 2
    There's no equivalent. If you add nodes to a scene graph, updating their properties will automatically result in a repaint. Alternatively, you can use a canvas, and redraw it, or possibly a `WritableImage`, and update it directly. – James_D Apr 19 '20 at 01:10
  • 1
    Two approaches are compared [here](https://stackoverflow.com/q/44136040/230513). – trashgod Apr 19 '20 at 02:38

0 Answers0