This discussion is archived
3 Replies Latest reply: Dec 4, 2012 5:19 AM by 913147 RSS

How to create charts with builder syntax

913147 Newbie
Currently Being Moderated
How can you use the XXXBuilder classes to build charts? I have this code:
NumberAxis xa = NumberAxisBuilder.create().lowerBound(0.0).upperBound(10.0).build();
NumberAxis ya = NumberAxisBuilder.create().lowerBound(-10.0).upperBound(10.0).build();
ScatterChart<Number, Number> chart = ScatterChartBuilder.create().XAxis(xa).YAxis(ya).build();
But I get:
error: reference to create is ambiguous, both method create() in RegionBuilder and method <X,Y>create() in ScatterChartBuilder match
          ScatterChart<Number, Number> chart = ScatterChartBuilder.create().XAxis(xa).YAxis(ya).build();
where X,Y are type-variables:
X extends Object declared in method <X,Y>create()
Y extends Object declared in method <X,Y>create()

How can I resolve the ambiguity?

(this is JDK 1.7.0_06, JavaFX 2.2.0-b21)


  • Correct Answers - 10 points
  • Helpful Answers - 5 points