2017-04-11 75 views
0

我正在做此NetBeans教程,我就死在这部分(https://platform.netbeans.org/tutorials/nbm-feedreader.html#threeNetBeans平台Feed阅读器教程

这里是我的代码有实现类:

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的noob,所以我不知道自己做错了什么。 你能帮我吗?

回答

1

增加 'NbBundle' 你进口:

import org.openide.util.NbBundle.*; 

这为我工作。您可能需要将'Base Utilities API'作为依赖项添加到您的FeedReader模块中。 (项目属性,库,模块依赖项,添加依赖项; 本教程显然存在一个错误,因为此解决方案依赖于不推荐使用的导入,但它现在应该可以运行。