Posted by samson on May 28, 2010 in
PulpCore
Proper coding practises dictates that we classify our code according to the nature and function of the class, making it as descriptive as possible. However, using Pulpcore Module for Netbeans, we cannot do that.
By default, we are prompted for a new project name, which is used only as the directory name, while the rest of the generated files are simply copied over and dump into the directory. When starting a new Pulpcore full project, we will be presented with the following listing for files.

After you have converted the pulpcore libaries to the latest release, you are still stuck with a group of files that would compiled to display ‘Hello World’, with a program title called ‘Hello World’ and a class called ‘Hello World’!
My method of changing this with little to no headaches is using Netbean’s refractor.

The following window will then pop up, change the class name to whatever you want.

Remember to check ‘Apply Renmae on comments’ as that will make your JavaDoc making more sense should you refer to the class that you are changing name for.

Now, if you attempt a build, it will actually compile. However, if you launch it, the player will state that it can’t find the class ‘HelloWorld.jar’. So to fix that we have a few more steps to take.
Next, navigate to
and change the two ‘HelloWorld’ to ‘MovingText’ or whatever you name your former ‘HelloWorld’ class.
Then, let’s navigate to
and change all the ‘HelloWorld’ to ‘MovingText’ or whatever you name your former ‘HelloWorld’ class.
Lastly, navigate to your Netbean’s project folder and find a file called ‘build.properties’, open it notepad or other simple text editor. Replace all ‘HelloWorld’ with the new name of the class file.
Now, you can go back to NetBeans and have the system ‘Clean and build’ again. All files in the ‘build’ folder will now be regenerated and linked properly to launch ‘MovingText’ instead of ‘HelloWorld’
Tags: Apply Renmae, Hello World, pulpcore, Using Pulpcore
Posted by samson on May 27, 2010 in
PulpCore
One of the major personal love for Java is its JavaDoc description, it is extremely handy when you are coding something and is on a quest for the proper method to resolve your problems, especially when you are not extremely familiar with the library that you are using. However, upto the latest post I wrote on Pulpcore, we are still getting a screen that looks like this when we attempt to read the documentations within Netbeans.

Annoying isn’t it? We know there’s JavaDoc with Pulpcore, in fact, we can easily access it online! Don’t believe me? Click here for the Pulpcore 0.11.5 JavaDoc API!
So, how do we go about doing this? According to the original authors of the NetBeans Module, you need to add some jar files and a brunch of doc files to get this up and running, I’ve found a more simple and reasonable approach.
Code Assist JavaDocs from what I recall back from Java 1.4 is actually source code related. If you have your source code there, the engine will first attempt to look for the method or variables and display the JavaDoc style comments you have included with that method or variable.
Luckily, Pulpcore is released with Source, we can easily take advantage of this.
- Navigate to your Pulpcore 0.11.5 folder and look for a zip file called ‘src.zip’ extract it to a sub folder called src.
- At this point, if your Pulpcore 0.11.5 files are in C:\pulp, then you should have a sub folder called C:\pulp\src\.
- Within C:\pulp\src, is a folder called src, and within this folder is a folder called pulpcore.
You should have a file structure like C:\pulp\src\src\pulpcore\, if you don’t just look for the plupcore folder, the name of the parent folder of pulpcore is the one that you need to remember. For my example, it is C:\pulp\src\src.
- Go back to Netbeans and navigate to the project properties.

- Navigate to Java source Classpath

- click on

- Type in C:\pulp\src\src and click on open.
- Click OK to save the Project Properties.
- Test the Code assistant again.

You are done
Now, you are not only getting the live documentations from the Java code of Pulpcore 0.11.5, when you are running into problems during debugging, you can easily access the source code of the Pulpcore to find out whether you are using a method properly or not.
Tags: java, JavaDoc, JavaDoc description, JavaDoc style, Navigate, Netbeans, proper method, pulp, sub, zip
Posted by samson on May 26, 2010 in
PulpCore
After publishing my previous post on Pulpcore, I realized that I have forgotten one of the major part I intended for that post, how to update your NetBeans Pulpcore libaries to the latest release. At the time of writing, Pulpcore is on Version 0.11.5.
How do I know which version of Pulpcore Libaries I am using?
That is actually really difficult to answer, as I don’t recall seeing any ‘Pulpcore version’ indication in the compiled code, the only way you can tell is from the console within the Pulpcore player itself. However, as we are all Java Adicts, we have a better way of finding that out from the code, we look for deplicated methods in the Library!
In class Pulpcore.sprite, there is a method called ‘setAnchor(int anchor)’
It was originally designed to allow users to set the anchor point on a sprite allowing for a easier point of reference. In the original pulpcore libraries, the method setAnchor would take in an interger presenting one of nine points, which looks like this:
NW N NE
+----+----+
| |
W + * + E
| |
+----+----+
SW S SE
With a predefined list of integers in the Sprite class in the form of Sprite.NORTH, Sprite.NORTH_EAST, etc…
However, this method is now deplicated in Pulpcore 0.11.5, the new setAnchor accepts two double, AnchorX and AnchorY.
setAnchor(double anchorX, double anchorY)
(0.0,0.0) (0.5,0.0) (1.0,0.0)
+----------+----------+
| |
| |
| |
| (0.5,0.5) |
(0.0,0.5) + * + (1.0,0.5)
| |
| |
| |
| |
+----------+----------+
(0.0,1.0) (0.5,1.0) (1.0,1.0)
With this as our weapon, we can easily find out whether we are using the newer Pulpcore Libaries or not.
NetBeans upgrade proceedures
So, continuing from yesterday’s post, now you have your first ‘Hello World’ program in pulpcore, let’s convert it to Pulpcore 0.11.5!
- Expand the file browser tree under projects like so…

- Double click on HelloWorld.java
- Navigate till you find something that looks like this
If this code compiled fine as it is, then you are not using 0.11.5 or later.
- To ensure we are indeed not using 0.11.5, change the code from (Sprite.CENTER) to (0.5, 0.5), Netbean’s compiler errors should immediately light up like a christmas tree like how we have here.

- Open your favorite file explorer and navigate to your NetBeans files. (eg: c:\NetBeansProjects\Hello World\pulpcore_dependencies\)
- Open your favorite file explorer and navigate to where you have extracted the Pulpcore 0.11.5 files, if you don’t have it, obtain it here!
- Navgate, in your Pulpcore folder, to the build folder. (eg: C:\pulpcore-0.11.5\build\)

- Select all of those JAR files and copy them over to your NetBeans Project folder’s pupcore_dependencies folder, replacing everything.
- Go back to NetBeans and click on the ‘Clean and build’ button
, you should see compile error gone, replaced by 18 warnings saying that the setAnchor method is deplicated.
- At this point, your Pulpcore library is 0.11.5, to remove the warnings, simply go over all the setAnchor methods and replace them with the newer style instead of the older setAnchor method style.
Tags: class, Netbeans, post, pulpcore, setAnchor, sprite, way
Posted by samson on May 25, 2010 in
PulpCore
After talking about Pulpcore in a previous post and another post on Netbeans IDE, let’s talk about using them together to create our first ‘Hello World’ Pulpcore game.
Please have Pulpcore Libraries Extracted to a location on your local hard drive and Netbeans IDE properly installed before you begin the following.
Navigate to the Netbeans Module for Pulpcore page using this link. Follow the installation instructions by the author of the netbeans Module.
I have duplicated the instructions here for easy access, it is simply 9 Steps.
- Download the Netbeans Module (nbm) file.
- Open Netbeans
- Navigate to “Tools” -> “Plugins”
- Click on the “Downloaded” tab.
- Click “Add Plugins”.
- Find your downloaded nbm file.
- Click “Open”.
- Click “Install”.
- Follow on-screen instructions.
Now you are ready to create the Hello World program. Follow these steps:
- Create a New Project
- Expand ‘Samples’
- Select ‘Java’
- Select ‘PulpCore Full Template’
- Click Next
- Type in ‘Hello World’ where it saids ‘Full’
- Copy down the Project Location, this is usually your ‘NetBeansProjects’ folder within your ‘My Documents’ folder.
- Click on ‘Finish’
- Press ‘Shift+F11′ to ‘Clean and build’
This will actually build your Pulpcore program already and if you click on Netbean’s build-in ‘Run Project’ buttons, it will launch the program. However, I don’t suggest this method for testing your code as the player doesn’t exit properly in Netbeans yet. It would be more ideal to launch the program directly with a browser. So, navigate to the Project Location you copied from Step 7 above and find the NetBeansProject folder. The folder structure should be like this:
‘NetBeansProject’ -> ‘Hello World’ -> ‘build’ -> ‘applet’
Find index.html and launch it using your browser.
If all goes right, you should see something like this.

Tags: Hello World, Hello World program, IDE, location, nbm, Netbeans IDE, Open, post, pulpcore
Posted by samson on Apr 22, 2010 in
Java
My first time using NetBeans, it was barely an IDE. Actually, it was just a platform that allows Java Developers to test their JavaBeans on. Running on Java 1.3.
So, since 1.3 to the end of Java 1.4, I have been using a simple IDE called Gel. Gel’s developers have stopped development since the launch of Java 1.5, and actually becomes non-usable since Generics was released. So I have been on the search for another IDE. At one point, I tried the famous Eclipse IDE however was extremely disappointed at the slow responses Eclipse have. JDeveloper was not a bad solution, however I personally am not very comfortable with using something that is branded with Oracle with MySQL or PostgreSQL.
After jumping into bed with several Java IDEs, I’ve decided to give NetBeans 6.5.1 another try. This time, I think I am set for my Java Development. It not only have a decent speed while loading up, it supports two other languages that I use all the time, C++ and PHP.
I personally think NetBeans have come a long way, one of the most amazing tool is the GUI interface. I recall that back in the days of Java 1.4, to create a typical Java GUI, I must code the the GUI piece by piece in code. However with the GUI interface editor, drag and drop with double clicking to code. This made GUI design and GUI coding A LOT easier then when I was learning Java.
To obtain the Netbean IDE please go to http://netbeans.org/. and download the version that fits your developmental system.
Tags: development, Eclipse, Eclipse IDE, Gel, Generics, java, Java Developers, Netbeans IDE, platform