Make your own web browser integrated in NetBeans IDE

Why someone needs integrated web browser in NetBeans IDE ?? I think it's very good thing for web developers. The web developing will become faster and more comfortable. I know two groups of people. First take all these aspects as good one and have a same opinion in it. The second one is against this feature and tells that doesn't like it and tries to stay out of this feature. So actually i was for a long time in the second group but till the time when i was developing larger web application. Suddenly i found out that it was very unconfortable due to that i have always opened at least 5 firefoxes and everyone is in the different desktop and if i want to deploy and run web application it is by default opened in the last used firefox tab. I always have to search for where my tested application has been opened. I have to switch among the desktops and this i really don't like. Actually in spite of these aspects i decided that i tried to develop a NetBeans plugin to integrate real (mozilla based not like the swing one which is unusable) web browser. Otherwise i haven't any presentable build yet but i try to show you how you are able to create your own browser in a short time. I take the liberty to dividing of the process into a few steps:
- Downloading and installing of the JDIC (Java Desktop Integration Components - we use the WebBrowser component from this package) - Creating of the NetBeans module project (I recommend to use the resources from Geertjan's Weblog. It's great) - Creating of the simple web browser (Actually as i mentioned we use the WebBrowser and we add it into simple swing gui using the NetBeans HtmlBrowser API) - Registering of this browser in NetBeans (We need it in order that the NetBeans would have known about our browser)
Let's start ;) Downloading and installing of the JDIC All resources about the JDIC are available at the JDIC project homepage. I recommend to use the latest build. You can download it from here. And for installation please read the installation guide (Set the JDK where the JDIC is installed as the NetBeans default). I have tried the JDIC on Debian Linux and on JDS SuSe version. On windows i don't know because i haven't bought regular license of the Windows for my personal computer and due to i can't use it (thanks Bill !!! ;)). Creating of the NetBeans module project So in this step we use a new great project wizard for creating NetBeans module. If you don't have it yet download it in the NetBeans update center. It's called "NetBeans Module Projects". And also you have to have the "Open APIs Support" module which is also available in the update center. Now you can create a new module project very comfortably. New Project wizard step 1 New Project wizard step 2 New Project wizard step 3 Creating of the simple web browser Now we can make a simple browser using HtmlBrowser which is in the package org.openide.awt and instead of this fact you have to import library module "UI Utilities API" (you can do that in libraries node in properties of the project). Project Properties Let's create the browser. Here is the complete browser which uses the WebBrowser component from JDIC package (thanks to Martin Grebac who helped me with). You can use it or you can make your own implementation. Registering of this browser in NetBeans This step is the most important. We have to tell to the NetBeans about our browser. For this you need these files and primarily its content:
- A Java class that extends HtmlBrowser.Factory and which makes the browsers from our implementation: MyBrowser.java - A Java class that extends SimpleBeanInfo and which takes care of basic informations about our browser: MyBrowserBeanInfo.java (we use extbrowser plugin for a few resources) - A settings file: MyBrowser.xml
And finally you have to edit module layer file (layer.xml):
<filesystem>
    <folder name="Services">
        <folder name="Browsers">
            <file name="MyBrowser.settings" url="MyBrowser.xml"></file>
        </folder>
    </folder>
</filesystem>
Now your project node should look like this one: Project Node Now you are able to build the project and create NBM file. For installing of the plugin use the NetBeans Update and there choose "Install Manually Downloaded Modules". After installing check if your module is enabled and primarily if your browser is set as default. If everything is alright you can run it. Click on View menu and there on "Web Browser". Your web browser is now opened. Enjoy it ;) ! Your Own Web Browser
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

marigan

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
News
Blogs

No bookmarks in folder