How To Make A Paint Application In Java
In this section, you create the construction of your application. You start need to create an application skeleton, which you can practise via a magician. And so yous will create the module that will contain your code.
Creating the Application Skeleton
The "NetBeans Platform Application" template will create your application's skeleton. The skeleton will consist of a ready of modules that work together to form the basis of your awarding. You will use the Project Properties dialog to assign your application's splashscreen, application name, and the type and number of NetBeans modules that you want to use. You can too have advantage of such actions as creating a Zip distribution and building a Java WebStart (JNLP) application, which are important tools in making your application available to other users.
-
Choose File > New Project. Nether Categories, select NetBeans Modules. Under projects, select NetBeans Platform Application:
Click Next.
-
In the Proper name and Location panel, type
PaintApp
in Project Name. Change the Project Location to whatever directory on your computer:
Click End.
-
The new awarding skeleton opens in the IDE. Look at the new project structure:
Yous see two subnodes in the Projects window. The first subnode, the "Modules" node, shows you lot the custom modules that are part of the application. Correct now, every bit you can run across, there are none. You can right-click on this subnode and so invoke wizards for creating new modules or for wrapping external JARs into the application. The "Important Files" node shows the build scripts and other supporting files used by the application.
-
Right-click the application and choose Run. The default splash screen is shown and then y'all come across the starting signal of your new application:
Look through the menu bar and the toolbar to see the features that your awarding already has, such as an Exit menu item, a Properties window, and an Output window.
Creating the Functionality Module
At present you need a module to contain the actual lawmaking you're going to write.
-
Right-click the "Modules" node in the Paint Application. Select Add New:
-
In the Proper name and Location console, type
Paint
in Projection Name.
Notice that the module sources volition be stored within a folder in the awarding's directory on disk. Click Next.
-
In the Bones Module Configuration console, type
org.netbeans.pigment
as the "Lawmaking Proper name Base of operations". The code name base is a unique cord identifying the module to other modules in the awarding. Exit everything unchanged.
Click Terminate. The IDE creates the Paint
project.
-
Have a await at the structure of your application. The project contains all of your sources and projection metadata, such equally the projection's Ant build script. The projection opens in the IDE. You tin view its logical construction in the Projects window (Ctrl-1) and its file structure in the Files window (Ctrl-ii). For example, the Projects window should look as follows:
-
Yous will need to subclass several classes that belong to the NetBeans APIs. All NetBeans APIs are implemented by modules, so this job really just means calculation some modules to the listing of modules that our module needs in order to run. In the Projects window, right-click the
Paint
project node and cull Properties. The Projection Properties dialog box opens. Under Categories, click Libraries. For each of the API'south listed in the table below, click "Add Dependency…" and and so, in the Filter text box, start typing the proper name of the class that yous want to subclass.
Form | API | Purpose |
---|---|---|
| | Enables loosely coupled advice betwixt modules. |
| | Provides annotations for registering Actions in the NetBeans Platform virtual filesystem, besides as the |
| | Provides a multifariousness of full general utility classes, including support for internationalization via the Bundle class and |
| | Gives you access to the NetBeans window system. |
The first column in the table above lists all the classes that you will subclass in this tutorial. In each case, starting time typing the grade proper noun in the Filter and watch the Module list narrow. Use the tabular array's 2nd column to pick the appropriate API (or, in the case of ColorChooser
, the library) from the narrowed Module list and then click OK to confirm the pick. Click OK to exit the Projection Properties dialog box.
In the Projects window, expand the Paint module's projection node and then expand the Libraries node. Notice that all the libraries you have selected are displayed:
Expand the Paint module'southward Of import Files node and double-click the Projection Metadata node. Find that the API's you selected take been alleged as module dependencies in the file. When the module is compiled, the declared dependencies are added to the module'south manifest file.
Source: https://netbeans.apache.org/tutorials/nbm-paintapp.html
Posted by: bellrownintoed.blogspot.com
0 Response to "How To Make A Paint Application In Java"
Post a Comment