Drabo has posted 12 posts at DZone. View Full User Profile

Create your First ExtJS 4 Application with NetBeans IDE

07.06.2013
| 16631 views |
  • submit to reddit

This article shows you a quick start for setting up NetBeans IDE for ExtJS 4 application development.

ExtJS is a "Cross-Browser Rich Internet Application Framework". It is based on JavaScript and web standards that help developers build pretty applications supported by several browsers. You can find more information (http://www.sencha.com) about this framework.

I've found the HTML5 features in NetBeans to provide excellent support for building an ExtJS application, as shown below. 

Create an empty HTML5 project

The first thing to do is create an empty HTML5 project in NetBeans by following the tutorial on the official website, that is, Getting Started with HTML5 Applications . 

  • "New Project -> HTML/Javascript -> HTML5 Application"  and click on "Next"  button.
  • Give a name to your project ( I choosed TutoExtJS) and  click on "Finish" button .


Download ExtJs 4

In order to have the ExtJs 4 librairies, you need to download the framework on Sencha website (sencha ).

  • Unzip the file in a temporary directory  and rename it as you wish ( I renamed mine "ext").
  • Create a directory on your project  were you will upload the extjs librairies directory  :
  • Right-click on the node "Site Root"  ->  "New -> Other -> Folder" and give a name to the folder ( I gave  "js").
  • Copy the  extjs directory and paste into the  js node ( image below)


Write your application

Now we are on the way to write our first  ExtJs application based on NetBeans

1 - Create the index.html

The index.html file is created by default. We will just replace the content with the code below :

<!DOCTYPE html>
<html>
  <head>
    <title>Account Manager</title>
    <link rel="stylesheet" type="text/css" href="js/ext/resources/css/ext-all.css">
    <script type="text/javascript" src="js/ext/ext-all.js"></script>
    <script type="text/javascript" src="test.js"></script>
  </head>
  <body></body>
</html>

2 - Create the javascript file test.js

Right-click on the project node => New => Other => JavaScript file  and give a name ( in the tutorial I named it test.js).

Replace the content of the new file by the code below :

function createNetBeansWin() {
    var win  = new Ext.create('Ext.Window', {
        id : 'myWindow',
        title : 'My first ExtJs Window with NetBeans',
        width : 300,
        height : 150,
        layout : 'fit'
    }); 
    win.show();
}
Ext.onReady(createNetBeansWin);


Your application is ready. Just run the application by right-clicking on the project and  "Run".


Published at DZone with permission of its author, Drabo Constantin.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Sean Phillips replied on Fri, 2013/07/12 - 5:17pm

Nice Drabo.   Finally an article to convince my HTML5 coworkers to use NetBeans!

I'm not particular big on Web Development anymore but I recognize its strength.  An article like this makes me want to try it out through my beloved NetBeans.

Drabo Constantin replied on Tue, 2013/07/16 - 10:03am in response to: Sean Phillips

Thanks Phillips ! NetBeans is becoming strong, many surprises are coming, you should start adopting it.

Ray Naa replied on Fri, 2014/09/12 - 7:59am

 

Thank you so much for the post you do. I like your post and all you share with us is up to date and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job.
 
https://www.rebelmouse.com/thatsnothowmenworkreviews/

Ray Naa replied on Mon, 2014/09/15 - 6:59pm in response to: Ray Naa

 

Great article with excellent idea!Thank you for such a valuable article. I really appreciate for this great information..
 
Veritas Inc

Ray Naa replied on Wed, 2014/09/24 - 3:15pm

Love the instructors here at Bright Spanish!! They are so intelligent and really helped me learn Spanish easily.
learn spanish

Ray Naa replied on Wed, 2014/09/24 - 5:23pm

 

It is imperative that we read blog post very carefully. I am already done it and find that this post is really amazing.
 
Premis

Ray Naa replied on Thu, 2014/09/25 - 12:44pm

 

Wonderful article, thanks for putting this together! This is obviously one great post. Thanks for the valuable information and insights you have so provided here.
elsa games

Ray Naa replied on Thu, 2014/09/25 - 1:56pm

 

It is imperative that we read blog post very carefully. I am already done it and find that this post is really amazing.
 
https://rebelmouse.com

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.