Create your First ExtJS 4 Application with NetBeans IDE

DZone 's Guide to

Create your First ExtJS 4 Application with NetBeans IDE

· Java Zone ·
Free Resource

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

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'

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


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}