IDEA告诉我它无法实例化; JavaFX没有问题。这个bug在哪里?

时间:2015-02-11 15:57:55

标签: java intellij-idea javafx

偷窃"来自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抱怨道:

enter image description here

突出显示时,消息只是它无法实例化&#34;。

这是IDEA中的错误还是错过了构造函数或什么?

0 个答案:

没有答案