Archive for category Browser

Fancy Preloader Part 2

Firstly welcome back to this blog if you are the reader of my previous post Fancy Preloader Part 1. I’m sorry for my late blog post because of some busy days. Anyway today I’m going to present you guys how to do animation for the Fancy Preloader. Firstly let’s look over parts of the Preloader Animation .
 

Fancy Preloader Animation

Fancy Preloader Animation

 
Read the rest of this entry »

Tags: , , , , , , ,

JavaFX Drag and Drop Cell in ListView

Hello guys. Today I’ve got some free time to blog. I have made small chemical solution for making these things happen. I was thinking that most of the game developers really need this type of system even more in the content management system also this kind of stuffs are very useful So I’ve planned to blogged about this (Drag n Drop Cell).

Let’s first look over how the things works for the Draggable of list cell.

Drag and Drop Cell in ListView

The above figure is just the concept which I’ve predicted. You can use your own too But in this post I’m doing all stuffs by this algorithm.By the help of that algorithm I’ve made the things sucess.

First let’s start with the custom cell I’ve given that cell name as ListCellX.
Read the rest of this entry »

Tags: , , , , , ,

Open Default Browser in Javafx

Hello I’ve seen many of the javafx programmer really likes the facilities of JAVA as everybody likes too. Javafx has capability to run the Java files by using JavaTaskBase, RunnableFuture (Interface). So today I like to present you guys, how can we open the default browser of system from javafx. Let’s begin.

Requirement:

  • Netbeans 6.5 or >
  • Javafx 1.2 or >

Ok Now let’s start with a new project from Netbeans. Start a new project of Java (I’m telling java not javafx). Then create a Java Project name as you want but at here I’m naming it as ‘Browser Starter’ with Java class name ‘BrowserStarter’. Here you have to add a very tiny Java code which opens the Default Browser of System .

package browseropener;

import java.net.URI;
/**
 *
 * @author Narayan
 */
public class BrowserOpener {

   /**
    *
    * @param url
    */
    public void open(String url) throws Exception{
        URI u = new URI(url);
        java.awt.Desktop.getDesktop().browse(u);
    }
}

Develop Java Jar file

Now that’s all for the Java. You have to do some stuffs . Here we go. Go to properties of your java project and do something like below picture . It will compress your project in jar form then click OK and press “Ctrl F11” for clean build of your project. Now you will see the jar file being made by Netbeans under <project_directory>/dist . Then copy that jar into specific place where you can use it easily for javafx later.

Create new Javafx project

Now let’s make a new javafx project from Netbeans As shown in figure below. Here we have some tricks which helps to import the jar file we’ve created just before ‘BrowserStarter.jar’ into javafx project.

Creating Library in Netbeans

In this step we are going to create a library so that Netbeans would easily get the java jar file i.e. ‘BrowserStarter.jar’ worked in our javafx project.Let’s see how it works. Go to Project Properties as shown in below.

Now click on Library Category > Add Library. The dialog would appear on window which looks something like this.

Now goto Manage Libraries > New Library again there would come a dialog like below. Here I named the Library Name as ‘BrowserOpener’ and clicked OK.

Ok now it’s time for adding jar files to our Library ‘BrowserOpener’ . Click on Add Jar Folders and specify location where you have kept the Java Project jar file i.e. BrowserStarter.jar

Now you can see our custom Library available in Netbeans Library. Simply click Add Library and it will add the library to your javafx project . Now it’s almost done. You can use this library any time you like in javafx project. Let’s see how javafx works our  library.(Create a main class file  if not exist) I’ve a main file named ‘Main.fx’ in my Javafx project and now i’m going to implement my library to javafx.

package browsertest;

import javafx.stage.Stage;
import javafx.scene.Scene;
import browseropener.BrowserOpener;
import javafx.scene.control.Button;
import javafx.scene.control.TextBox;
import javafx.scene.layout.HBox;

/**
 * @author WEBNEP
 */
def textBox = TextBox {
                    text: "http://google.com"
                    columns: 12
                    selectOnFocus: true
            };
Stage {
    title: "Application title"
    scene: Scene {
        width: 250
        height: 80
        content: [
            HBox {
                content: [ textBox,

                   Button {
                        text: "Button"
                        action: function() {
                            var opener:BrowserOpener ;
                            opener = new BrowserOpener();
                            opener.open(textBox.text);

                        }
                    }]
                }

        ]
    }
}

It’s time to compile and run our application. Please run the project by pressing ‘Shift+ F6’ and now there must be application window like below. Click on Button and you ‘ll be able to browse the url on System default browser.

Thanks for watching this blog.
Please don’t hesitate to comment. 🙂 Good day

Tags: , , , , ,

Updated Date and Time in JavaFx (Bind)


/*
 * Class : DateTrack.fx
 *
 * Created on Nov 20, 2009, 3:35:25 PM
 *
 =============================================================
 This program will update the date of your current System Date
 Now we are tracking date via help of UTILITY CLASS "DATE"
 and we are taking advantage of the Timeline and init()
 If any thing goes wrong then please comment me
 ==============================================================
 */

package practice;  // you can change as per your package

//Import Directives...
import java.util.Date;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import javafx.animation.Timeline;
import javafx.animation.KeyFrame;

/**
 * @author NARAYAN
 */
//--------------------
//Variable declaration
//--------------------

var myDate = "";  // just initializing..

//This will execute init() of Clock Class
var myClock = new Clock(); 

//Declaring Class Clock for updating Date
class Clock {
    public function nextTime() {
        var now = new Date();
        myDate = "{%tEc now}";
        /*
        * {%tEc now} is the extended format used
        * for the java.util.Date object ("now").
        *
        * %tx - Localized date
        * %tX - Localized time
        * %tu - A day of the week (1-7, 1 is for Monday)
        * %tEx - Locale's alternate date representation
        * %tEX - Locale's alternate time representation
        *
        */
    }

    // THIS WILL BE EXECUTED AT FIRST...
    init { //INITIAL
        var time = Timeline {
            repeatCount: Timeline.INDEFINITE
            keyFrames: [
                KeyFrame {
                    time: 1s
                    action: function() {
                        nextTime();
                    }
                }
            ]
        }
        time.play(); // TAKING ACTION TO PLAY
    }
}

Stage {
    title: "Application title"
    width: 250
    height: 80
    scene: Scene {
        content: [
            Text {
                font : Font {
                    size : 16
                }
                x: 10
                y: 30
                // Binding the current date
                // which helps to show updated date
                content: bind {myDate};

            }

        ]
    }
}

Tags: , , , , ,

A FaceBook Apps (IP TRACKING SYSTEM)

Hello! I’ve made a small java application via javafx.
It’s apps name is IP Tracker System
Funtion:

  • Displays your IP
  • This helps to find which Country you are from
  • Also Region and City is displayed

For FaceBook Users: You can simply get this apps from Facebook by this link: IP Tracker System in FaceBook

Other: Just click at this link to see javafx application of IP Tracker System in FaceBook

Snap Shot:

JAVAFX FACEBOOK APPS

If you see Blank then please download Java from here

Tags: , , , , ,