nb developer faq - What are the basic things I should know about NetBeans' architecture to get started?

 

Getting Started

Tutorials and important starting points

What are the basic things I should know about NetBeans' architecture to get started?

The most important thing is to know what you are trying to do clearly, so you can find what you need to get started quickly. Here are some basic NetBeans factoids which will either answer some questions or whet your appetite for more information:

重要的是你要作什么,你可以很快的找到你想要的。下面是一些基础的NB细节,可以回答你的一些问题:

A module is a JAR file with some special manifest entries. The NetBeans IDE (5.0 and up) has lots of support for building modules.

Modulejar文件,包含一些特殊的manifest入口。ide5以上在这个方面有很多支持

Modules usually affect the system by putting entries in an XML file inside their JAR, which the system reads.

Module通过写入jar文件中包含的一个xml文件来影响系统

You can add to, remove from, change or completely remove menus from the main window, toolbars and other things from a module

你可以通过模块中增加、删除、改变或全部删除窗口的菜单和工具条或者是其他东西

To show your own tabs in the main window, you will want to subclass TopComponent

如果你要在主窗口中显示你自己的tabs(活页),你得继承TopComponent

The windowing system provides facilities for tracking selection, and actions can be made sensitive to selection. Selection typically centers around use of Nodes; it is also possible to have context sensitive actions without Nodes.

窗口系统(Windowing System)可以很方便的跟踪你的选择,操作可以对选择敏感,通常选择主要是指节点的实用,而没有节点的操作也是可以的

It is possible to build tree and other views of objects very quickly using Nodes in conjunction with Explorer Views

可以用节点和Explorer Views(浏览器视图)方便的创建树或其他对象的显示

Many pieces of NetBeans UI are really views of some folder in the configuration filesystem which modules install things into The configuration filesystem is read-write, and changes can be saved to the user's settings directory

很多的nb用户视图都是对配制文件系统的展示,很多模块按照后会写入配置文件系统,配置文件系统是可读写的,而且对配置的改变保存在用户配置的目录

Applications built on NetBeans do not have to be IDE-like - there is plenty of support for editing files available in the Editor module and friends, but you do not even have to include those modules in your application if you do not use them

Nb创建的应用不一定得和nb一样,在编辑器相关的模块都支持对文件编辑,但你甚至可以在你的应用中不使用这些模块。

A lot of things in NetBeans are based around file recognition and using files to provide Java objects. Even if your application has nothing to do with editing files, this may still be very useful to you, since the same mechanism that recognizes/displays a user's files on disk also recognizes/displays configuration data (which may not even be files in the traditional sense at all), and such "files" can actually be factories for whatever kind of object you want (and that way you get persistence of those files for free).

Nb中,很多机制都是通过识别、使用文件,来产生相关的java对象,甚至你的应用根本就不是文件编辑的,但些机制对你来说都很有用,因为配置的读写、显示也采用了这样的机制(这些配置很可能就不是传统意义上的文件),这些“文件”可以是你需要的对象的“工厂”(这样,你就可以自由的对这些“文件”进行存取)

For example, the FeedReader tutorial simply serializes POJO Feed objects into the configuration filesystem , and its whole UI consists of aiming a standard tree component at a folder full of those objects, and providing a few actions to let the user create more of them. When the application shuts down, it does not need to any special code for persisting them, it is all automatic.

For more information about how that works, see the section on file recognition.

例如:FeedReader例子,就是把POJO Feed对象保存在配置文件系统,整个的用户界面由目录树组件来显示很多这样的对象,同时提供少量的操作,让用户创建这些对象。当应用退出的时候,不需要为保存写代码,这些都是自动的。查看更多请查看:文件识别部分

One of the most basic and important things to know about is how modules register objects - this is mainly done through a configuration file inside the module's jar file (if you are using NetBeans 5.0 or greater's module building support, you can usually avoid hand-editing this file). Most things a module does to influence the environment are declarative rather than programmatic - in other words, you put some text in an XML file, or an entry in a jar manifest, or a file in some specific place in the module jar, and your functionality will be discovered when the system starts up - as opposed to writing java code.

最重要、最基础的机制是:模块怎么注册对象-主要是通过模块jar文件中的一个配置文件来完成的(如果你用nb5.0或以上,你可以不用手工的编辑这个文件)模块影响环境是通过宣言的形式,而不是通过编码的,也就是说,你在一个xml文件中写入一些配置文本、或者jar manifest入口、或者模块jar文件中的特定位置的一个文件,当nb启动时,这些功能会被nb发现,而不是去写java代码

Two of the most common needs are opening custom Swing components in the UI, and installing actions in the main menu .

两个最常用的需求是:在用户接口打开特殊的Swing组件,在主菜单中增加操作

Other basic topics that are worth reading to get the lay of the land are:

其他的主要话题也是值得一看

Lookup

Lookup

How to run some code on startup

怎么在nb启动时运行一些代码

Overview of filesystems

文件系统综述

The windowing system

窗口系统

There are various tutorials, and the canonical reference to NetBeans APIs is the API javadoc .

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值