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

Swing

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

Hi,

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,


Narjes

----- 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!

Hi,

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

Regards,

Kiran

UVCE, Bangalore

http://ieeeuvce.org


On Sun, May 11, 2008 at 1:10 PM, Narjes Hamed <narjes.haimed@gnet.tn> 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


Narjes

----- 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!

Hi,

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.

Regards,

KIRAN

UVCE, Bangalore


On Sat, May 10, 2008 at 6:23 PM, Narjes Hamed <narjes.haimed@gnet.tn> 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


SO HERE'S HOW WE MAKE A NEW JFRAME OPEN AT THE CLICK OF A BUTTON

  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,

    @Action

    @SuppressWarnings("deprecation")

    public void ShowNew() {

    if(x==null)

    {

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

    }SwingApp.getApplication().show(x);

    }


  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 kiran19882004@gmail.com



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



Thursday, April 17, 2008

CUSTIMISING THE IDE

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());

x+=273.15;

textField1.setString(String.valueOf(x));

textField.setString("0");

}

  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 ;)

EXPLORING AROUND

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?

The CRUD




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;
length=d[i++];

breadth=d[i++];
//height=d[i++];

}

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;
num=Integer.parseInt(jTextField1.getText());

x=num;
for(;x!=0;x=x>>1) {y++;}
noofbits=y;
int i=0;
for(int j=noofbits-1;j>=0;j--)
{
z=((z*10)+((num>>j)&01));
}
jTextField2.setText(String.valueOf(z));
}


vi)GOTO the converterAboutBox.java 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….

Saturday, March 22, 2008

First Java Program with netbeans 6.1

It makes sense to try out the basic hello world program to check the IDE's core functionalities. So we go to File->New Project. This pops up the following screen that has so many types of projects that the IDE can handle!!

We select the basic Java Application and click Next. That brings us to the dialog where we name the project and set its working area. We let the default location stay and just name the project HelloWorld. Notice that the main class is automatically named.

Aha!! One of the major advantages of having an IDE is automatically generated code. See the window below, package, class and the main method structured well automatically. No difference from previous netbeans IDE’s as well, it’s the same saga going on(nobody asking for changes though :D).

Just type System. And see the pop up list of Intelligent IDE. Oooh IDE’s makes programmers life so easy. One note of caution though don’t use an IDE if you are a novice programmer because Intellisense really makes bad programmers.

Finalize the code as follows:

/*

* To change this template, choose Tools | Templates

* and open the template in the editor.

*/

package helloworld;

/**

* @author Kiran

*/

public class Main {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

System.out.println("Hello world");

}

}

Press F6 to run the program and notice that the Output panel appears….
Cool na?

Thursday, March 20, 2008

First look..


The 6.1 version automatically took my settings from my previous installed version. The splash screen does look cuter than the old one :D

Well about the start page, nothing much to say than that it has everything in one place. You could actually get to know a lot of things by going to the what's new section. And ofcourse you could get to your project right away too.

Installation

Installation was quite hassle free, just had to click a few next buttons. You won't have to actually configure anything if you have JDK already installed in the system.
Full installation package... he he...

First Bite @ Netbeans 6.1

Just the other day i stumbled across Netbeans IDE 6.1 beta. Being a netbeans user for quite sometime now, i thought why not blog about the very IDE that has brought me closer to my love java.So i just downloaded the entire package and was on with it in full zoom. Read my experiences here at my blog.

By the way you can get the IDE at http://dlc.sun.com.edgesuite.net/netbeans/6.1/beta/