Friday Apr 17, 2009

Bullet Graph - RIA + JavaFX !

Finally we are able to finish one more article on Data Representation. My special thanks to Stephen Few who has written the concept of Bullet Graph. An awesome way to represent lot of data in one screen. Basically used on Executive Dashboard to compare between predicted value and actual done.

In terms of Animation, this is different in comparison with other Data Rep. Articles. Here the data loading is sequential in nature. Actually if someone is making it for presentation purpose, the best way is to show the animation on Key hit, very similar to what we do in ODP or PPT presentations.Some small code of AppletExtension is also there, which will show you the power of JavaFX API. When you drag this applet out of Browser, you will not see the custom close button.

Feel free to comment or add anything you want in this.

Friday Jul 11, 2008

Applet and JavaFX and Confusion

Two weeks back in BOJUG meeting, I have seen lot many engineers getting confuse with JavaFX. They want to know how to run FX code in browser. Shall we use applet to run FX code. And many more. Though it tough to explain everything in a small presentation but Harish Singh and we have tried our best to explain some of the queries. Yes, FX can be very well run in an applet. I have written one HelloWorld type of example for running FX code inside applet. Its very well same. \*.fx file create a .class file and then handling in the same way as we do with .class file.

Here is a small code for "My Hello World" (HelloApplet.fx)

import javafx.ui.\*;

Applet{
  content: Label {
    text: "My Hello world!"
  }
} 


Now you have to compile this with javafxc, so that we can use class file. For that you need to download javafx compiler, runtime and some more jars. From this link you can download it.

Now here is little tough part, making html file for applet :-). Tough because you get to know which jar files your code is using. And you will not get documents readily to say you which API belong to which package + API's in themselves are changing. So, you may not able to run your older codes. Anyway, I have written this html code(Hello.html):
<html>
  <body>
    <applet code="javafx.ui.Applet" width=480 height=560
     archive="javafxrt.jar, Scenario.jar, javafxgui.jar, javafxc.jar, javafx-swing.jar, javafx.jar">
     <param name="AppletClass" value="HelloApplet"> 
    </applet>
  </body>
</html>


Don't ask me why I have added some many archive. I got frustrated in knowing what residing where. And so, I have ended up adding all the jar that I have seen in the archive(in the link) :). Check it out, let me know if there exist any problem.

Surprisingly you can call Frame also from applet, check this code:

import javafx.ui.\*;
Frame {
   title: "Hello World F3"
   width: 200
   content: Label {
      text: "Hello World"
   }
   visible: true
}
In the next blog I will also cover some other way to use on web.

Tuesday Jun 03, 2008

Draggable Applets - 6u10

JDK 6u10 is one of the major attractions in JavaOne 2008. 6u10 came with tons of features like:

1. Kernel JRE download

2. Draggable Applet

3. Improving JS support

4. Better Vista Support 

... and many more

I am here writing the MOST simple example for draggable applet. Off course, Hello World :-).  Here is the code:

  
import java.awt.\*;
import java.applet.Applet;

public class HelloWorld extends Applet {
    public void paint(Graphics g) {
        g.drawString("Hello World",50,50);
    } // end of paint
} // end of applet

One line code change in the HTML file:

<APPLET CODE="HelloWorld.class" WIDTH=200 HEIGHT=100>
<PARAM NAME="draggable" value="true"/>
</APPLET>

And now you can see how applet will come out of the browser and runs as a different process. Closing browser will not going to make any effect on applet life cycle.


You can clearly see the MS Windows in background :) and a very cute close button with the applet, independent applet. And off course a different process in task bar.   

About

Hi, I am Vaibhav Choudhary working in Sun. This blog is all about simple concept of Java and JavaFX.

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