I am investigating the feasibility of developing a JavaFX 8 control based
on Canvas.  I have chosen Canvas as the base class as this control is of a
very dynamic nature and would not be easy to implement with a retained mode
style ancestor (at least as far as I can tell).

So is this feasible?  While I can readily see how to render the visual
aspects of the control, I am not sure how to best "embed" other controls
within it should that become necessary (and almost certainly will).

For example, how would I go about embedding a Button within my control?  It
looks to me like I would need to create an actual Button node somewhere
else in the scenegraph and then perhaps render it within my control using
gc.drawImage() passing in a snapshot of the Button node.  That's OK but
then I have to somehow handle events and I am not sure how best to do that.

Another issue I see is that there seems to be no way to apply effects to
individual graphic elements within the Canvas as the applyEffect() method
applies to the entire Canvas.

Finally, a significant obstacle is this issue:

https://javafx-jira.kenai.com/browse/RT-23822

This issue relates to the lack of support for LCD font smoothing within
Canvas.  This may not sound that serious but the difference between LCD
font-smoothed text in other controls and the grey-scale text in Canvas is
so distinct on my current machine that a control based on Canvas would
really stick out like a sore thumb and appear significantly less appealing
than a "standard" control.

So, am I wasting my time?
Are there any other issues I am likely to face?
Are there other ways to develop dynamic controls which may involve
thousands of nodes (such as lines, curves etc.)?

Thanks,

Felix

Reply via email to