偷窃"来自here的代码我创建了一个扩展JavaFX AreaChart
的类,以便创建一个"平滑线区域图表":
/**
* An {@link AreaChart} with smoothed lines
*
* <p>Code totally salvaged from <a
* href="http://fxexperience.com/2012/01/curve-fitting-and-styling-areachart/"
* >here</a>.</p>
*
* @param <X> x axis data type
* @param <Y> y axis data type
*/
public class SmoothedAreaChart<X, Y>
extends AreaChart<X, Y>
{
public SmoothedAreaChart(@NamedArg("xAxis")final Axis<X> xAxis,
@NamedArg("yAxis") final Axis<Y> yAxis,
@NamedArg("data") final ObservableList<Series<X, Y>> data)
{
super(xAxis, yAxis, data);
}
public SmoothedAreaChart(@NamedArg("xAxis") final Axis<X> xAxis,
@NamedArg("yAxis") final Axis<Y> yAxis)
{
super(xAxis, yAxis);
}
@Override
protected void layoutPlotChildren()
{
// Lots, lots of code
}
}
我在FXML文件中使用它:
<BorderPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="com.github.fge.grappa.debugger.csvtrace.tabs.treedepth.TreeDepthTabDisplay">
<top>
<!-- blah -->
</top>
<center>
<SmoothedAreaChart fx:id="chart" legendVisible="false"
title="Tree depth by line" animated="false">
<xAxis>
<NumberAxis fx:id="xAxis" tickUnit="1.0" autoRanging="false"
minorTickVisible="false" forceZeroInRange="false"
label="Line number"/>
</xAxis>
<yAxis>
<NumberAxis fx:id="yAxis" forceZeroInRange="true"
minorTickVisible="false" autoRanging="false"
label="Tree depth"/>
</yAxis>
</SmoothedAreaChart>
</center>
</BorderPane>
现在,正如$ subject中所提到的,FXMLLoader
没有问题;然而,IDEA抱怨道:
突出显示时,消息只是它无法实例化&#34;。
这是IDEA中的错误还是错过了构造函数或什么?