Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

JavaFX painting question

$
0
0
I've slowly been trying to migrate towards using JavaFX as opposed to swing. I've read tutorials, coded some basic stuff, etc. I'm not particularly interested in understanding all the CSS FXML yadda yadda stuff. Right now I'm attempting to understand it in a manner similar to Swing (which I'm already familiar with). As I understand it, the levels are Stage -> Scene -> Nodes. Where nodes represent some graphical component that can, but doesn't necessarily, handle input. Buttons, panels, all the normal Swing stuff is basically a node.

I've searched on Google and here on Dream but can't seem to find anything that's even remotely analogous to painting in Swing. I understand of course that JavaFX and Swing are different. However, it doesn't seem an incongruous thought to think that nodes should provide some method akin to paint, paintComponent, repaint, etc. The only one similar ones I found were setGraphic and getGraphic which are methods of a Labeled object. Are these the "sister" methods to the Swing methods, or have I missed the point? Is it possible to paint on a direct subclass of a Node object, similar to the Canvas object? Is the Canvas object what I'm supposed to use?

In Swing, to alter the appearance of a lightweight component I would tinker with one of its paint methods. The overall question here is how would I do this in JavaFX? I realize there are CSS states for rollover, pressed, etc. However, I'm looking for a more fine-grained solution.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>