Friday, August 8, 2008

The ugly side

Guess what, Netbeans doesn't live up to its tagline of being the only IDE you need when you get into serious development work with this IDE especially in terms of Enterprise Development. Here are a few major problems that i've come across with this IDE that has forced me to end my journey and switch to another better IDE.

1. Ever tried to integrate off some other interpreted code(.class). from another project onto your working project. Don't tell me you can do it, because i know you would be bluffing, as that is one among the major drawbacks of netbeans.

2. has more to offer in . They started with this idea, and don’t have to follow it ( is still in early stage). It’s amusing to read from the people what it already offers and that you can write as easy. But, have a look at the tutorials. It’s not the same quality offers to concentrate on the “business logic”.

3.Installation: Eclipse comes as a simple zip file which need to be unzipped. That’s it you are ready to use the IDE. NetBeans comes as an exe and during the installation time it asks for the JDK location. Some how i did not like this as it could have automatically taken from system settings as eclipse does.

4.Refactoring: Basic refactoring techniques are present in both the IDEs. But Eclipse does have advanced refactoring functions. e.g. when extracting a method, eclipse does show how the method looks like. Some time it also suggests the input parameters for a method.

5.Search System: For sure Eclipse does have a advanced search system. NetBeans have a file level an project level search and replace system. But Eclipse definitely have more than that. Eclipse has File Search, Java Search and Plugin Search. And i personally use these a lot and definately miss them in Net beans.

Thursday, May 15, 2008


Here's the conversation that made me think I need to post this entry


Thanks for your test_example, I' am now trying to get a result from that, it seems that there are still some errors.

as soon as it works i'll let you know.

Best regards,


----- Original Message -----

From: Kiran

To: Narjes Hamed

- Hide quoted text -

Sent: Wednesday, May 14, 2008 6:09 AM

Subject: Re: my project: Vlan Network Simulator with Java / help!


Please find attached a simple java project. Tinker around with the code and u'll learn how to fulfill your requirement.



UVCE, Bangalore

On Sun, May 11, 2008 at 1:10 PM, Narjes Hamed <> wrote:

Hi Kiran!

Thanks for yr prompt reply, I ask u again if you may provide me with a java source showing relations between buttons and frames:

For example if I have a Frame "A" and a Frame "B" and if I click on button "a" included in the Frame "A", the Frame "B" is opened, using of course action commands.

Please try and let me know how to do that.

Kind regards


----- Original Message -----

From: Kiran

To: Narjes Hamed

Sent: Sunday, May 11, 2008 6:14 AM

Subject: Re: my project: Vlan Network Simulator with Java / help!


Its quite nice to hear from you. I really do not know the extent to which i can help you, but you wouldn't be facing problem's 1 and 3 if u are using netbeans. All u need to do is to have a new swing based desktop application project with database support enabled. Its pretty to add the events up in the GUI. and yeah u can use either an mysql or a jdbase database. For your second problem, take your input as a string, use a loop to take out individual chars, group from one '.' to another '.' and parse each group into an int for validating or create your own customized object to handle that type.



UVCE, Bangalore

On Sat, May 10, 2008 at 6:23 PM, Narjes Hamed <> wrote:

Dear Kiran,

Good day,

I visited your blog and I found it very interesting, I wish I don't disturb you with my intrusion ,

I am a Tunisian student and I have to prepare a java project concerning " vlan network simulator " within one month;

I use Netbeans 6.1 and Jbuilder 2005 but as I' am not experienced in java language I don't know how to start.

I enclose with this message the starting of my project;

My main problems are:

1 / How to use the function "actionevent", "actioneventlistener",..........etc, to connect buttons with other frames to open them or close them.

for instance if I click on "about" menu item button the frame"about" appears.

2 / How to format a textfield to input an IpAddress: ***. *** .***. ***

3 / How to prepare a database to intoduce:

- user name - password

- connection parameters ( IpAddress, port, socket......)

May you help me? some links or other ideas.....

your assistance welcomed.

Many thanks in advance and best regards.

Narjes Hamed

Sousse / Tunisia


  1. File->New Project->Java->Java Desktop Application
  2. Name it as swing and choose basic application shell
  3. Right click on swing new->Jframe Form and name it as NewJFrame
  4. Draw a button on the swing view and select action from the right panel
  5. Select create new action and name it ShowNew

    Screen clipping taken: 5/15/2008, 12:00 PM

  6. Your show code must be as follows, first add a private Jframe x; in your list of variables then,



    public void ShowNew() {



    x=new NewJFrame();x.setBounds(50, 50, 200, 200);



  7. Remove entirely the main function in the NewJFrame
  8. Now u get the following when u click show, voila done now rite? Any more queries mail me at

    Screen clipping taken: 5/15/2008, 12:11 PM

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?