NetBeans 平台提要 Reader 教程

NetBeans Platform Feed Reader Tutorial

我正在做这个 Netbeans 教程,但我卡在了这部分。(https://platform.netbeans.org/tutorials/nbm-feedreader.html#three)

这是我为 class 实现的代码:

package org.myorg.feedreader;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
import org.openide.windows.TopComponent;

/**
 *
 * @author Kidnapinn
 */
@TopComponent.Description(
        preferredID = "FeedTopComponent",
        persistenceType = TopComponent.PERSISTENCE_ALWAYS)
@TopComponent.Registration(
        mode = "explorer", 
        openAtStartup = true)
@ActionID(
        category = "Window", 
        id = "org.myorg.feedreader.FeedTopComponent")
@ActionReferences({
    @ActionReference(
        path = "Menu/Window", 
        position = 0)
})
@TopComponent.OpenActionRegistration(
        displayName = "#CTL_FeedAction")
@Messages({
    "CTL_FeedTopComponent=Feed Window",
    "HINT_FeedTopComponent=This is a Feed Window"})
private FeedTopComponent() {
    setName(Bundle.CTL_FeedTopComponent());
    setToolTipText(Bundle.HINT_FeedTopComponent());
}
public class FeedTopComponent extends TopComponent {

}

我是 Java 的菜鸟,所以我不知道自己做错了什么。 你能帮帮我吗?

将 'NbBundle' 添加到您的导入:

import org.openide.util.NbBundle.*;

这对我有用。您可能需要将 'Base Utilities API' 添加为 FeedReader 模块的依赖项。 (项目属性,库,模块依赖,添加依赖;。 教程中显然存在错误,因为此解决方案依赖于已弃用的导入,但现在应该 运行。