2017-04-11 74 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模塊中。 (項目屬性,庫,模塊依賴項,添加依賴項; 本教程顯然存在一個錯誤,因爲此解決方案依賴於不推薦使用的導入,但它現在應該可以運行。