Thursday, April 17, 2008


Whenever using any computer program its customization to suit our needs becomes important. Netbeans 6.1 has left no stone unturned to provide an user interactive and fully customizable IDE.

  1. Goto Tools->options
  2. The Editor tab lets you choose Code completion, folding options as you require, but hey check out the code templates. Did you know that just typing psvm and then giving a tab could get you the entire public static void main(String[] args) {} Moreover you can set your own templates to get blocks of code in just few abbreviations. Talk about customizability!!!
  3. The java code tab lets you choose what all indentation you require and what all types of coding hinds the IDE should offer you. The same goes for Ruby.
  4. For people who like to play with the look and feel of the IDE to soothe their tastes, the fonts and colors section lets you customize anything to everything.
  5. People who want to get their work done faster always use shortcuts and guess what the keymap section allows you to set the keyboard shortcuts down to the last action the IDE can perform.
  6. For people who really have problems getting their netbeans to handle C/C++ this is the section they should check out. If your compiler is not listed, First add it to the path list and then select the compiler. And one note the netbeans IDE doesn’t seem to support the TC compiler, it has compatibility only with the G++.

Wednesday, April 16, 2008

A mobile Application

Though there are a lot of sample projects given with Netbeans IDE, I thought I could really demonstrate its full potential in MIDP through a simple step by step robust application design for a Celsius to Kelvin scale converter app for java enabled phone.
  1. Select File->New Project->Mobility->MIDP Application
  2. Set the project name as MobileConverter and remember to keep Set as main project and Create HelloMIDlet checked
  3. Select the emulator type, here we’ll tryout the Sun JAVA™ wireless. We’ll be right now programming for a default Color phone with the older CLDC 1.0 config and MIDP-1.0 profile(That’s what my phone supports). Click finish.
  4. Goto the Screen view and let us now. Click on the text and change its property to Hello, Welcome to Mobile Converter
  5. Goto Palette and drag and drop a text field item and label it as input.
  6. Drag an Ok command from the list of Commands and label it as Convert.
  7. Now goto the flow tab and drop in a new form. Name it as output form.
  8. Drag a back command and drop it on our new form. Draw connection lines as shown.
  9. Goto the screen tab, choose the new form and drop in a textfield to show our output.
  10. Now goto the source code. Write the following method in your MIDlet class.

public void setans()


float x=Float.parseFloat(textField.getString());





  1. Goto screen, in the new form right click and goto source. In the place where you find // write post-init user code here call the setans method by setans();
  2. You finally have your own mobile app. Click on build and then deploy. Your jar file will be generated in the dist folder. Transfer it to your java enabled phone and enjoy ;)


Its only when you try around coding new things do you really understand where this IDE leads you on the context of one of the most powerful programming languages JAVA. Consider one of the really emerging fields of programming embedded systems and mobile phones. In the New Project window try out creating a MIDP Application from the Mobility Section. Press F6 to check the cool emulator :)

The following are notable improvements:
  • New Integrated UI for CLDC/MIDP and CDC development. The Mobility pack now supports the project properties previously available only for CLDC/MIDP projects. These include project configuration support for device fragmentation, integrated obfuscation and optimization support, and multiple deployment options, all built on Apache Ant for easier coding and management.
  • New game builder. Now it's easier to create mobile games with the Mobility Pack's visual editing support for the MIDP 2.0 Game API. The API supports animated sprites and the ability to arrange tiled layers into scenes.
  • New Visual Mobile Designer. The Visual Mobile Designer (VMD) has been re-designed for improved functionality and usability.
  • Design analysis. Design Analysis identifies unused components for removal from complex visual designs .
  • New custom components. New components for the Visual Mobile Designer simplify the creation and design of mobile file browsers, Short Message Service (SMS) composers, login screens, and Personal Information Manager (PIM) browsers.
  • New components for Flow Control.
  • Generated code is now easier to modify.

Netbeans 6.1 is all you could ever ask for! What else can you probably ask?


I’ve been eluding people of the databases for long. Recently I had worked on the .NET platform to create a stock market simulator and it was hectic. Just the other day I just created a sample JAVA Database Application and got the shock of my life. It was simple, ready to use and it was god damn it, the power of JAVA unleashed in a shell called Netbeans 6.1.
The following screenshots will really demonstrate the power this IDE gives to your hands.

Simplicity is everything ;)

Monday, April 14, 2008

NETBEANS 6.1 - what lies beneath....

CAUTIONARY NOTE: This section of blog deals with the non explicitly visible features of the Netbeans IDE. These features are by no means 'new'.

Since any novice can figure out his way through this IDE, i thought i would show you a few cool shortcuts to exploit a few hidden features of this very powerful java IDE.

1) The intelligent code text replacer

Consider the following code for the area application. Consider the scenario in which you need to replace your class variable 'length' with another name say 'l'. Finding all instances of 'length' in the code and replacing it would be nonsensically time consuming. However using a replace all in a text editor causes us problems as we have used the method length to get the no of arguments. However netbeans 6.1 editor has a new feature that helps you out of this situation.

package area;
class dimension

float length;
float breadth;
float height;

public void getdim(float ... d)


int i=0;



public static void perimeter(float ... d)
float p=0;

for(int i=0;i<=d.length;i++) { p+=d[i]; } System.out.println("perimeter="+p); } } public class Area { public static void main(String[] args) { float area,volume; dimension obj=new dimension(); obj.getdim(1,2); obj.perimeter(1,2); area=obj.length*obj.breadth; volume=obj.length*obj.breadth*obj.height; System.out.println("area="+area+"volume="+volume); } }

Just select an instance of length and press Ctrl+R which brings up the Rename field dialog.

Give the new name that you desire, 'l' here in our example. And voila, what an intelligent replacement. The variable name successfully changed with the line
"for(int i=0;i<=d.length;i++)" in our code intact. This is an IDE with awesome power people!!!

2. The next not so easily seen feature is the code insertion/generation feature. Just try pressing Alt+Insert keys and you'll find a few insertion options. I really don't understand why good things aren't that easily spot able ;-)

Check the constructor feature in our area program. Truly functional, check the generated code

public dimension(float l, float height) {

this.l = l;

this.height = height;


Lets try the most common job we do in classes, i.e. add properties. Relatively easy, and highly customizable options presented.OMG!! What are you making us? Programmers or just intelligent typists? I mean you got even a getter and a setter code block!!!

What else can you possibly ask for?

The power of GUI

Let me now demostrate how to build up a simple GUI for a simple decimal to binary converter.

What do we need in our GUI?
1) A simple base window of customized size and attributes.
2)An input field
3)An output field
4)A Result button
5)An Exit button.

How to do?

i) Click on File-> New Project-> Java-> Java Application,and click next.
ii) Give project name as Coverter, and select the basic application shell. We'll deal with databases later. Click on finish to find the following screen.

iii)We'll now add from the swing Controls two text fields for input and output respectively, and our two buttons. With little rearranging after drag and drop and changing sizes our window looks like this.

Sleek and slim like we require.
iv)now to the coding part. Right click on the exit button and select Events->Action->Action performed
The following code is generated
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
//TODO code here

In the area of the comment type System.exit(0); to complete the exit button functionality.
v) Now select the action for the Convert button. Here's the code for the conversion BTW

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
Integer num;
int x,y=0,noofbits=0,z=0;

for(;x!=0;x=x>>1) {y++;}
int i=0;
for(int j=noofbits-1;j>=0;j--)

vi)GOTO the and design it as you please.
vii) Press F6 to check out your fully functional Desktop application.
Cool to have something functional isn't it ;)

Monday, April 7, 2008

Talking of databases....

One of the new things that come to your notice when you use netbeans is the new found support for MySQL databases. The new beta lets users register MySQL servers. Databases may be viewed, created or deleted. Connections to databases may be established and users can launch the MySQL administration tool. This is blessing for web developers so depended on MySQL. Now, that's a CRUD.

Netbeans – Two real advantages

Well after having complained a little on my previous post let me now throw light into the major forte of netbeans enlisted below.

1.GUI: The major requirement of today’s developers is to have a good User Interface for their users. They can provide whatever functionality they need but it’s the GUI that lets the user better know the existence of that particular functionality and its easier for them to click and select than type something on a black boring screen. Thus, today’s developers need IDE’s such as netbeans that develop ready made windows forms with all the required buttons, labels, text boxes and like that can be tailor made for the program in question.

2.Database Integration: Database based program developers know how hard it is to interface your back-end database to your front-end program. This is where netbeans packs the punch by providing you a CRUD(create, Read, Update, Delete) application shell. Life’s easy, isn’t it ;)?

Netbeans the best of JAVA IDE’S - what’s missing?

We'll now slightly shift from the tutorial mode to discussion of this IDE for a while. Its true that, by far of all the java IDE’s I’ve tried out netbeans has come out in the top. But with every netbeans release I’ve looked for one major part of the functionality that has been missing. Users might have checked out the options in the editor for case sensitive code completion. The big question is why it doesn’t work? When we type a part of the code say ‘system.out.println’ it just puts a red squiggly line underneath regardless of the code completion option, where it should be capitalizing the s in the system. If you start with a capital S, the IDE still requires you to completely type out ‘System.’ For the IDE to recognize what we are referring to and then list out the various options. This finds the netbeans IDE lacking a major feature compared to IDE’s on rival technologies such as Visual Studio .NET. This to my belief leads to a clutter than absolute ease of use as we need to know exact code casing and entire code sequences thus putting a higher level of knowledge in keyword cases. A note for beans developers, when you want to provide code completion as you type as feature, make it a proper complete feature, not put half the functionality in there….