Netbeans平台的一些概念和基础知识

开发Netbeans RCP前需要一些基础知识:
原文
  • 一个模块其实就是一个带有特定manifest条目的JAR文件,Netbeans支持创建模块,而其本身也是模块搭键起来的.
  • 模块如何和Netbeans系统打交道呢?答案是通过模块内部的一个XML文件来和Netbeans系统交互,这个XML文件被称为层次文件(Layer file/Module Layer),通常是layer.xml. Netbeans系统将会读取这个文件.关于这个层次文件,我们以后详细介绍
  • 通过模块,你可以改变主窗口或者工具栏等地方的菜单
  • 通过继承 TopComponent类,来在主窗口中创建自己的Tab窗口
  •  窗口系统能够方便的跟踪用户的选择.而动作也可以使对选择敏感的.通常选择是围绕着节点的使用,但是你也可以拥有上下文敏感的动作,而无需节点.
  •  通过结合使用节点和查看器视图,你能迅速创建对象的树视图或者其他视图.
  • 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
  • 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

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).

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.

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.

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

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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值