Welcome to the Java Community Forum and interact with 2 million technicians entering NetBeans may be the biggest winner of the JSR-296 project, which can help developers take the next step in their project, if there is no NetBeans, they may not know how to do this, as they replaced JFrame with the SingleFrameApplication class in the JSR-296, because
Welcome to the Java Community Forum, interact with 2 million technicians> entering NetBeans may be the biggest winner of the JSR-296 project, which can help developers take the next step in their project, without NetBeans, they might not know how to do it, as they replaced JFrame with the SingleFrameApplication class in the JSR-296, because
Welcome to the Java Community Forum and interact with 2 million technical staff> enter
NetBeans could be the biggest winner of the JSR-296 project, and it could help developers take the next step in their project. Without NetBeans, they might not know how to do it, for example they replaced JFrame with the SingleFrameApplication class in the JSR-296, because using it can be easier with the JSR-296 (I refuse to call it the Swing application framework, SAF, because the name is too arrogant, it seems that there are no other Swing application frameworks), especially with the help of NetBeans IDE, many developers have done so and quickly saw their development results.
But unfortunately the JSR-296 has stopped development, and when you create such an application with the latest NetBeans IDE 6.9, it will warn you that the JSR-296 has not continued development, as shown in.
Figure 1 warning information when a Swing application is created in NetBeans 6.9
So now there are more developers who need the NetBeans platform, because only it can provide the most reasonable next step for Swing applications, especially when your code is heavily written with JSR-296 specifications, if you cannot find JFrame in your code, you may focus on your business area rather than infrastructure. Therefore, you need to manage the lifecycle, Action system, and Task, you still need them, and these NetBeans platforms are retained for you.
After in-depth conversations with some developers who are switching to the NetBeans platform, I will summarize the 10 practical tips for moving to the NetBeans platform. If you have plans to switch to the NetBeans platform, you may want to learn from others' experiences first.
1. Follow the CRUD tutorial
Various tutorials are available for download and reading, and even video tutorials are available everywhere. However, here I recommend the CRUD application tutorials on the Netbeans platform, I recently met a developer who was very confused about the NetBeans platform. After I recommended this tutorial to him, his questions were significantly different, this tutorial covers typical application scenarios of the NetBeans platform. You can learn more about the NetBeans platform, APIs, and processes. There is no reason to start the NetBeans journey without reading this tutorial.
2. Print the Refcard of the NetBeans Platform
A major problem facing the NetBeans platform is the scope. In other words, what can the NetBeans platform do? Why do you want to use it? At this time, watching video tutorials is the most helpful, but you should also print the most basic NetBeans platform Refcard. It covers a wide range of content, and even the smallest details will not be missed, in your programming process, you can give you a lot of code tips and coding skills.
3. Prototype
Quickly implement a prototype so that you know what you need and everything is easy to do. Therefore, you can use the prototype to know the difficulty of achieving the goal as early as possible and back up your source code, create a new NetBeans platform application in NetBeans IDE, create a new module, paste your code into this module, and then package all the third-party development libraries used, set dependencies as needed, create a TopComponent, and display some data in your new application window. The prototype is set up.
4. Convert external JAR into modules
A headache that developers often ask is "is it true? Do I need to package all my databases into modules? Why ?", If you want to create a modular application, you can benefit from modularization, such as dependency management, version control, and information hiding, you can even put multiple JAR files in the same module (in the "library package into module wizard", Press CTRL to click or press Shift to click ), but you need to think about the reason for putting multiple JAR files into the same module, because your goal is to create a modular application, therefore, the JAR files that should be placed in the same module should be organized together.
5. Think about the modular Boundary
When should I create a new NetBeans module (or OSGi bundle )? It is important to read the article "how to split applications into modules" (http://java.dzone.com/news/how-to-split-into-modules.
6. register the Action class
Since NetBeans 6.7, you generally no longer need a subclass of the Action class on the NetBeans platform, and have a detailed explanation in the article "which NetBeans platform Action class should I use" (http://netbeans.dzone.com/news/which-netbeans-platform-action, why is that good? Because now you can directly copy ActionListeners and AbstractActions from the original application and paste them to the NetBeans module. All you need to do is register them correctly, and you will be done, this means that your Action class has been moved to the menu and toolbar. Calling them from keyboard shortcuts is just a registration issue, and it does not involve complicated coding.
7. Love Layer
A layer is your best friend. A "layer" is an XML file. Each module has a maximum of one layer. When an application starts, each layer is added to the virtual file system, you can register what you like on the layer, and then you can read this layer from Java code. It sounds abstract, but if you read the pluggable JXTaskPane example (http://blogs.sun.com/geertjan/entry/pluggable_jxtaskpane), you think it's easy, and that's the most amazing place to move your app, create a folder (folder) in the layer and name it "Products". Then, register a folder under "Products" for the new product provided by each module. In your code, you can traverse the Products folder, locate all Products, and display them in the application window. Service providers can also register on the layer. For details, refer to "How does a NetBeans extension work ?" (Http://netbeans.dzone.com/news/netbeans-extension-points) article.
8. Retain JPanels
Is JPanels used in your application? If you use it, you should be very happy, because you can do nothing to continue using them, create a new TopComponent class, and then call add (myJPanel, you can also use the options or wizard window. For example, you can find out what JPanel can be used to configure (in the options or wizard window ), as an editing panel in the window, you can use it multiple times in different places. You only need to call add (myJPanel) in the NetBeans platform container that you work on.
9. participate in the community
By participating in the community you will certainly get more gains, you can see important content in the dev@platform.netbeans.org Mail List, a variety of questions and answers to the response, the more you know, the more you should take advantage of the opportunity to share your experience with others, the more involved you can be in the development of some community applications (http://platform.netbeans.org/screenshots.html) to contribute to the community.
10. transfer is a process
51CTO believes that the transfer is a process that can not be completed at half past one, and may need to release several product iterations, so there must be a corresponding plan, for example, when you transfer to the NetBeans platform and release the first version, you may simply transfer the JPanels to the TopComponents of the new platform. In the next version, you may want to package your business objects into a Node class so that they can be displayed in the resource manager view, including the property window, which should be adjusted at your own pace. Depending on the scale to be transferred, it may take weeks or months for you to spend on the transfer. This is normal. If you don't have that much time, you should consider step-by-step implementation, determine the function to be transferred for each version. There are no rules to follow. You just need to arrange it according to your own needs.
This is my summary. How do you feel after reading this article? Do you have other suggestions? Hope to see your comment!
Original article name: 10 Tips for Porting to the NetBeans Platform
Author: Geertjan Wielenga