Friday Feb 27, 2009

CodeJavaFX Contest

  • How many times have you seen a really cool UI and said WOW!!
  • How many times have you enjoyed playing a cool game on your mobile or on the web?
  • How many times have you enjoyed watching a movie or listening to your favorite music from your PC or mobile?

What does it take to create these kind of applications that everyone enjoy? - With JavaFX, nothing !! It's simple, straight-forward and easy to create rich, immersive user experience across desktops/Mobile and you will only be limited by your creativity.

CodeJavaFX Contest 

Sun Microsystems provides a great opportunity for students and developers in India to develop these cool applications using JavaFX through CodeJavaFX contest and you get to win some exciting prizes. All valid contest submissions also get a participation certificate from Sun Microsystems and a JavaFX T-Shirt. Best Applications will be featured on javafx.com with your profile.

Prizes 

Registration closes pretty soon. RUSH !! 

Get your hands wet with JavaFX technology through CodeJavaFX contest and Be a Pioneer in the RIA market. For queries, please send an email to codejavafx@sun.com .


Thursday Feb 26, 2009

SunTech Days 2009, Hyderabad, India

Another important developer event that I attended recently was the SunTechDays' 2009 at Hyderabad. It's been a few years since I last visited the event and lot of things have changed since then for the better - the venue, the technologies, the organizers etc and the passion towards learning new stuff is always on the raise. I actually expected lesser no of people this time due to the economic downturn but the moment I entered the venue, I was proved wrong. In fact, I had to squeeze in to reach the JavaFX stall that I was manning. The convention center was flooded with professionals and students !! The venue (International Convention Center) is really one of the state-of-the-art infrastructure for such mega-events and on par with the Moscone center in SFO where JavaOne is held every year. 

The center of attraction was of course 'Father-of-Java' - James Gosling, one of the most admired celebrities in the technology arena. The event started off with a musical bonanza where a 10 year old boy was playing Drums for 20 mins or so. The audience were captivated entirely by his performance and there was a pin-drop silence for few moments when he gave a break and people had to gather themselves to put their hands together. Only at that time, I realized that I have tears on my eyes since I had kept them open for so long. He looked as if he has 10+ limbs while playing the drums. He is indeed a child prodigy !!

KeyNote

KeyNotes started with some cool demos on JavaFX, Java TV and OpenSolaris and some of them actually triggered many 'WOW!'s. People were getting restless and eager to see James on the stage and finally when he arrived, there was a thundering applause. It's amazing to see the amount of excitement, respect and admiration that people show towards this man and of course, he deserves it for innovating a technology that touches people around the globe through every bit of device that they use.

JavaFX Stall

JavaFX clearly took the center stage at Sun Tech and all the JavaFX sessions were full-house. Right after every session, people stormed the JavaFX Stall asking multiple questions, watching demos and it was a challenge for me and my colleagues to streamline the people, given the limited space for the stall. Our neighboring stalls also felt the pinch due to this and at times, they asked when is the next JavaFX Session, just to get prepared. It would have been worth even If I had taken my entire team out there to handle the stall. But it clearly demonstrated the value and potential of this platform and the excitement that it's been creating in the developer community. Another thing that attracted people was the CodeJavaFX Contest (For Students and Professionals in India, please sign up for the CodeJavaFX Contest if you have not already done so. It's a great opportunity to unleash your creativity and showcase your talents and you get a chance to win Exciting prizes) from Sun for Professionals/Students in India to contribute cool RIAs written in JavaFX and we have been getting an overwhelming response. Overall, It was an exhaustive ordeal but very satisfying at the end.

My Session

Theme of my JavaFX Session was to take the audience through the development of A Rich Internet Application and demonstrating it on Desktop and Mobile. I and my Colleague Rakesh Menon were there at the Stage driving the session and we demonstrated the development of a Media Browser application that facilitates navigating through media and image contents obtained from the web through FX-WebServices. It was a code-walkthrough session and we were showing a demo after developing each module. This helped us keep the audience awake especially in a post-lunch session. Main objective of our session was to emphasize on rapid development of RIA and the ease with which it can be done using JavaFX with NetBeans. people seemed to have grasped that pretty well at the end of the session. There were lot of interesting questions from various modules in FX such as Langugage, Graphics, Scenegraph, Language, Media, Animation etc and some of these questions were really sharp to the extent of taking them offline accompanied by lengthy conversations.

   

Slides can be found here.

Overall, It was a good learning experience for me connecting bright professionals and students across india and I would definitely like to be there next year as well.

Students grab the JavaFX PIE !!

I am back to blogging after a small gap (Blame the JavaFX Momentum) and I am here to share some of my good experiences from my recent university trips. I got a chance to visit a couple of techfests @ premier universities in india few weeks ago to conduct workshops on JavaFX technology. I should say I was simply amazed to see the amount of enthusiasm and excitement that this technology has created among the students. 

The workshops were conducted at techfests organized by NIT, Trichy and SASTRA (near Thanjavur), 2 esteemed universities in TamilNadu, India. Students from different colleges across TamilNadu participated in the techfest and what I witnessed there was a well-organized gathering of extremely vibrant, energetic student community with a strong apetite to learn new things.

It was a whole day event organized into 3 hours of theory session + 3 hours of Lab, in each of these techfests. I wish it could have been an open-to-all workshop but I have to blame the lab capacity that enforced constraints on the organizers to limit the participation. Nevertheless, the way these workshops were organized was remarkably good and I should thank the student organizers who went out of their way to make this happen.

 Myself standing infront of SASTRA

\\SASTRA Session


 Attending the theory session is the most boring part in the college and I used to fall asleep sometimes, while I was in the college. So we wanted to do this differently at the techfests and so we prepared about 30 cool demos to be shown as we proceed through explaining different areas. This trick worked indeed. We kept the students on their toes through these demos and the expectations about the subsequent demos were going up after showing each demo. Overall, the theory session came out much more productive for us and informative and interesting for students.

 

 

In the post lunch session, we wanted to gauge how did the theory session go. So we asked some leading questions on different FX features covered in the pre-lunch session and students were throwing-in the answers before we could complete the questions. We initially announced some goodies for people who answer these questions but we had to close down the Q&A session quickly since the response were overwhelming and we were running short of goodies.

NIT Organizers

Typically Students love the lab sessions since they get to try things hands-on and that was the case in techfest too. All the necessary softwares and exercise materials were pre-loaded on every machine in the lab and we did not even waste a minute on setting things up, thanks to the student organizers again !! We started off the lab sessions with pre-defined exercises specially designed for newbies to get started with JavaFX and students were provided with the JavaFX SDK and Netbeans 6.5. We actually thought we could relax a bit here but lab sessions ended up much more tiring than the theory sessions since we were bombarded with lot of questions. We kept running around all over the lab answering queries as We guided them through the exercises step-by-step. Finally, to our surprise, students completed the exercises 30 min ahead of the schedule and that demonstrated the ease-of-use of JavaFX Script and APIs. Remember these were folks who had no prior knowledge of NetBeans, most of them did not know Java or at the most knew very little Java and most of them had only heard about JavaFX till they signed up for the session!! 

So as to make good use of the last 30 mins, we floated a small contest to encourage students to unleash their creativity and come up with their own application. Students never looked tired and took the challenge seriously. This time, they had no limits compared to the lab exercises and they were trying all sorts of things from pasting their photographs on the background to creating advanced effects such as reflection, ripple effects and animating objects all over the screen. At the end of the contest, we were fascinated to see some really cool apps and games coming out of it and it was challenging to pick the winner. At this point, We did realize in realtime the power and potential of JavaFX in faciliating rapid development of rich applications and how powerful the technology could be when we make it simple and easy-to-use.

I would like to appreciate and thank these students for taking up the workshop with lot of excitement, energy and passion and this definitely encourages me to reach more universities and colleges for conducting similar workshops.

Overall, It was a tiring but very rewarding 2 days and I wish I get more energy to cope with these guys.


 

 

 

 


Thursday Aug 23, 2007

FX animations contd - A rudimentary screensaver

I was little off the hook with FX for a week now since Consumer JRE has taken up most of my time. As stated in Chet's blog, there is so much of cool stuff lined up for the Java community through consumer JRE and catch a glimpse of it when you get time.

Coming back to FX, I wanted to spend some time on Groups which can be considered as a non-visual container that offers the capability of combining multiple visual objects together and performing various transformations on the group as a whole. Groups by default introduces a new coordinate system and graphical objects assigned to the group are placed with respect to the group's origin.

The flexibility and convenience that the group offers to FX programmers is significant in my view and the ability to treat multiple objects as one and being able to perform operations/transformations on the group of objects as a whole is simply awesome. Groups directly exposes one of the primary advantages of the underlying scenegraph model, to the FX developer.

As I stated in one of my earlier postings, one of my other goals was to use pure FX animation loops in lieu of Swing Timer. But I was little short of ideas when it came to developing a small demo. Sitting in front of my machine, I was thinking for a while and fortunately it was long enough to trigger the screensaver on my linux box that broke my desktop into pieces. That gave me the necessary jolt to overcome the inertia and I came up with a small screensaver kind of application.

I still call it rudimentary because it is nowhere near the original screensaver that triggered it but nevertheless, it was a good starting point for me.

FX ScreenSaver

In this application, I am rotating and zooming various geometric objects individually and as a group as well. In addition to that, I am also trying animate multiple rectangles on the screen which would show the contents of the desktop right below it. All the objects would zoom out and zoom in repeatedly.

Click on the image to launch it. You would need JDK5+. While the screensaver is running, click on it to alternate between 'Transforming individual objects' vs 'Transforming a group'. You will see the difference pretty clearly. Right click on the screensaver to exit.

FX ScreenSaver

 
This animation is using Pure FX animation loops. It was little hard to get the synchronization right for zoom in/zoom out. Zooming should reverse only when all the objects reach the min/Max possible size and I am also changing the rotation angle at the same time alongwith opacity.

Take a look at the script -

screensaver.fx

Clipping 

I have slightly modified the screensaver demo given above to set the clipping region to the union of 4 different shapes shown in the screenshot, keeping the background intact. FX provides Clip class to this. I have defined the 'shape' attribute of the Clip class to be the union of 4 different shapes. Additions, Intersections, Subtractions, Xor of shapes can be achieved through built-in subclasses of Area - Add, Subtract, Intersect and XOR. That's pretty straight-forwrd. However, I am not clear why the commented part of the code inside the Clip construct in the source is not working?!!. That should ideally do the same what the uncommented piece of code does.

(Click on the screenshot to launch the application. You would need jdk5+. Click the mouse to exit)

Screenshot

Source Script -

clipping.fx

I am going to take a small break (perhaps a week!) from FX to get back to Consumer JRE. Stay Tuned ...   

Monday Aug 13, 2007

FX animations - Capture the falling objects

As a continuation of my learning process, I wanted to find out What would it take to write a blocks game in FX.  Though I have not made the progress that I promised on using the FX animation loops in lieu of Swing Timer, I made little progress over capturing keyboard interactions from the user using 'onKeyDown' of the Canvas and 'KeyboardAction'. In general, it was simple & straightforward to just associate a keystroke with an operation using the KeyboardAction, for any FX widget and there are enumerated values for most of the keystrokes. The same values could be used in the 'mnemonic' attribute as well.

But some mnemonics doesn't seem to work for me. For ex, I want to use ESCAPE as a mnemonic for a 'cancel' button in a dialog whose action would be close the dialog. I am still not successful in getting this work. I need to find out if ESC keystroke is getting consumed by the top-level or by the native.

FX Blocks 

Here is a small game where objects keep falling from the top and the player has to move the cup at the bottom using keyboard/mouse capture those objects. You can configure the size of the object and the speed with which the objects reach the bottom.

(Click on the image to launch the game. You would need jdk6+) 

FX Blocks

FX Blocks Script

Next I would like to go into transformations & clipping of individual objects and groups as a whole.. Stay tuned.
 

Wednesday Aug 08, 2007

Animation through FX and Java

With reference to what I have said in my earlier posting, I have made little progress over doing animations using FX syntax. I have tried this with another app before actually changing the PingPong code. Here also, I initially started with a Swing Timer but later replaced it with the FX's animation syntax - '[..] dur xx linear' and I have created a trigger for the above property that keeps changing at regular intervals.

Bouncing Balls (Click on it to launch)

(Click the left mouse button to add more balls and Click the right mouse button to quit)


 
Here is the script that use the Swing Timer

BouncingBalls.fx

I will have to tune the performance since the app slows down when I add more balls. Perhaps, I need to see if I can use different threads one for each ball, to animate it or I will have to increase the delta by which the balls move.

Bouncing Balls using FX animation loop (Click on it to launch)

(Click the left mouse button to add more balls and Click the right mouse button to quit)

Bouncing Balls using FX animation loop

Here is the script that use FX animation loop

FXBouncingBalls.fx

It is pretty simple indeed but one has to get the values right inside the FX animation syntax to get notification at correct intervals - especially the distribution of range of values over the given duration.

Tuesday Aug 07, 2007

Learning JavaFX? Join me..

JavaFX has been creating lot of buzz since JavaOne'2007 and I could not overcome the temptation to try it out myself and see how it brings down the complexity of developing Rich UI contents. I have been into the Quality side of Java2D/AWT area for quite sometime and my goal is to see how easy it is to develop some cool 2D graphics and animations in FX.  I am pretty much impressed with my first interaction with JavaFX.

I am still in the process of learning JavaFX and my Java knowledge hampers the learning process a bit. That's because JavaFX offers the flexibility of writing Java code and calling Java programs from within the FX script and I often tend to misuse that flexibility even in the places where FX offers much more easier ways of doing things than Java (primarily due to the declarative syntax for the UI). Due to this fact, I am getting more cautious now when I am about to write something in Java inside the FX script.

Nevertheless, it is good to share whatever I have developed so far -

PingPong

I had this game written in Java and I just wanted to port it to JavaFX. It was pretty easy in fact and I was able to do it in a few hours (That's actually good considering that I am just a newbie with FX syntax and semantics). But pardon me for some Java code that I have put in the script and I will be migrating them to FX as I climb up the FX ladder.

FX PingPong screenshot

 

I have used the Swing Timer class to do the animations to start with. I was really excited about the simplicity with which I can move the ball/bat, just by changing the x,y property and binding takes care of updating the UI.

Just try it yourself (You would need jdk6+. It might take a couple of minutes to load, the first time) -


Here is the script -

pingpong.fx

I am in the processing of writing few other apps in the 2D/Swing area and I swear it will have more FX stuff than Java. Stay Tuned !!

Friday May 18, 2007

Test Harness and tools

Now that OpenJDK is out and I would like to open up some of the discussions that have been happening within the OpenJDK Quality team of Sun to the community. My colleague David has initiated it already in his blog on Test Suites and tools and this is a continuation of the same.


As David pointed out in his blog, we do have different set of tests such as JCK, Unit, Regression, Performance etc to ensure OpenJDK quality at different levels of the the product life cycle. Out of all, we (Software Quality Engg Team) are directly involved in developing the Functional tests which is equivalent to a home owner visiting the site and inspecting if his/her new home meets all the requirements from a user's perspective. On the other hand, the unit testing (Done by the Development Engineering team) could be considered equivalent to a building inspector's visit who would ensure that the internal systems such as electrical, plumbing, foundation etc are of high quality.

Coming to the point, the crux of discussions are centered around what harness/framework we should be using for the tests that we open up for the community? When I say Harness (Tonga - internal name, being used internally within SQE), it is something that is loosely coupled with the tests as such and can execute tests, collect results regardless of how the tests are written. Whereas, a framework (Say Junit) is a tightly coupled one which gives you a pattern, an interface where you can implement the necessary portions of the interface to test a scenario. Now which approach we would want to take?

 There are pros and cons in each of these approaches. The harness approach gives you the flexibility that you need in writing tests and you could potentially write tests for scenarios having different requirements, data, etc. For eg, the tests written for the client side (2d/awt/swing/deployment) do have requirements that vastly differ from the tests written for core components such as io, vm, libs etc primarily due to the user interactions and associated visual aspects. with the given flexibility, you could use the same harness to write and execute tests for client as well as core components. Of course, there will be certain rules on how the test should communicate it's status, messages to the underlying harness but not as stringent as a framework.

 The framework approach sometimes gets limited to what it can cater to or we would require multiple frameworks to deal with varied requirements of different component areas of OpenJDK (Consider client, core in the above example). But on the other hand, it would be relatively easy to write a test since you already have a pattern that you have to follow and all the tests are guaranteed to be consistant. Consistancy helps in debugging, maintaining especially when dealing with a huge testbase.

 We had this discussion many years ago within SQE and we decided to have transitioned to the harness approach from framework approach due to the flexibility that it offers and the varied requirements of different component areas in the JDK. That's when we chose the Tonga (internal name) harness. But now JDK is open to the community and we would like to revisit this and see what would be the best for the community as a whole. Your feedback is valuable. You can comment right here or in David's blog or send email to OpenJDK Quality mailing list.

Wednesday May 09, 2007

Want to know more about the Quality of OpenJDK?

Today Sun has fulfilled the promise of open-sourcing fully buildable Java Development Kit (JDK) version for Java Platform Standard Edition (Java SE) to the OpenJDK Community as free software under the GNU General Public License version two (GPLv2) and this is an exciting news for all of us. There are plenty of opportunities for the community to get involved in OpenJDK in terms of finding bugs, fixing bugs, testing OpenJDK on platforms, video cards, browsers, locales and hardware that has not been attempted at Sun earlier and so much more.

 Being a Quality Engineer at Sun, I am looking forward to your participation in taking the quality of OpenJDK to greater heights. You can get a feel of how things are done on the quality side of OpenJDK by visiting the OpenJDK Quality Portal which offers information on the quality process, Test Methodologies, JDK Quality Metrics, Articles and white papers and a Quality FAQ.

Sun has a broad range of testing activities and test suites but nevertheless the community have got much wider knowledge base of customer applications, environments and data that sun has not attempted before. It is important for both of us to make JDK/OpenJDK work seamlessly with those specifics and OpenJDK Quality Portal is a good opportunity to collectively work together to share the knowledge and make OpenJDK meet all our requirements more closely.

 Please visit our collaboration page for more information on how you can collaborate with the OpenJDK Quality team at Sun. You can also email your suggestions and ideas on improving OpenJDK quality to OpenJDK Quality Discussion alias. Watch out for more updates on the OpenJDK Quality Portal.

 

Wednesday Mar 01, 2006

AWT Modality Enhancements in Java SE 6 (Mustang)


Modality is always one of my favorite topics just for the fact that lot of interesting customer feedbacks flow in frequently. As a test engineer for Java SE, that's what I am looking for since it keeps me busy and makes my job interesting. On the other hand, this also indicates that modality is one of the widely used features in the client side, be it swing or AWT.

On Java SE 6 (code named Mustang), my work became even more interesting with lots of enhancements being made in the modality land. These enhancements provide lot more flexibity to the application developer in designing the behavior of the modal dialog that his application may bring up. Before getting into the enhancements, let us first see what AWT was offering prior to Mustang.

From it's introduction AWT has only offered two types of modality - Modal and Modeless.

Modal -> Any time a modal window was displayed, all windows in the application would be blocked.
Modeless -> A dialog that will not block any of the windows.

It would be interesting to think through certain facts here -

  • Why should a modal dialog block all the windows in the application?
  • Wouldn't it be good if the modal dialog just blocks the parent window and not other windows?
  • Wouldn't it be good if the application developer decides (instead of AWT) what windows should be blocked by the dialog that his application brings up?


  • Say if an application user wants to scroll through the help window to see what selections he/she could make in the dialog, when a modal dialog is active, how could he do that?

    AWT has addressed this on Java SE 6 , which is now offering 4 types of modality in the order of larger to narrow scope - Toolkit, Application, Document and Modeless. Choose the right modality type for your dialog depending on your needs.

    Toolkit - Choose this type if -

  • Your dialog has to block all the windows in your application (except the ones from the dialog's child hierarchy)
  • Your dialog should block your applet and all other applets from the same toolkit
  • Your dialog should block the browser itself
  • You want to use a dialog with highest scope of blocking

  • Application - There is not much difference between Application and Toolkit modality as far as normal applications are concerned. But if you are developing an applet, then it is important to know the difference. Here you go ->

  • If there are several applets launched in a browser, they can be treated either as separate applications or a single application depending on what browser you use (Check your browser documentation). Application Modal dialogs will block all the windows from the same 'application'
  • This is the default modality type taken if you do not specify anything for your modal dialog

  • Document - Choose this type if -

  • Your dialog has to block only the windows from the same document('document' is determined by the top-nearest window without an owner).
  • Your dialog should have least scope of blocking, next to being modeless

  • Modeless - Go for it if you don't want your dialog to block any of the windows

    (Since Toolkit modal dialogs can block the browser / Java WebStart, you require an AWTPermission 'toolkitModality' to use this type of modality from within an applet)

    Overall, this provides lots of flexibility to the application developer in choosing the right modality type for each dialog depending on the extent to which it should block the other top-level windows in the application.


    Modal Exclusion
    There is another scenario where you have many windows in your application and you want your modal dialog to block all the windows except one. In such a case, you will have to choose the modality type that has the largest scope of blocking but would it be possible to exclude those windows that should not be blocked, from being blocked by the dialog? - YES Indeed!!

    Let's see what AWT offers in this area -

    AWT has introduced 2 modal exclusion types in Java SE 6 .

    Exclusion from blocking of toolkit-modal dialogs
    If a window is toolkit-modal excluded, it is not blocked by any application- or toolkit-modal dialogs. Also, it is not blocked by document-modal dialogs from outside of it's child hierarchy (Note: If you are within an applet environment, you would require the AWTPermission - 'toolkitModality' to use this exclusion type).

    Exclusion from blocking of application-modal dialogs
    If a window is application-modal excluded, it is not blocked by any application-modal dialogs. Also, it is not blocked by document-modal dialogs from outside of its child hierarchy.



    Modal Excluded Window
    Window excluded from App Modality

    By default, a window's modal exclusion property is turned off in the sense that it gets blocked by default if it falls within the scope of blocking of any of the modal dialog that is made visible.


    Before using any of the Modality or Exclusion types, check whether it is supported by your platform by calling the methods isModalitySupported(), isModalExclusionTypeSupported() provided in the java.awt.Toolkit class.


    Parent-less Dialogs
    Historically, dialogs always have a parent associated with it. But is it really necessary that a dialog should always have a parent? - Not Anymore!!

    Now it is possible to create an AWT dialog with a null parent on Java SE 6 by passing a 'null' in the dialog constructor for the 'parent' value. In previous releases, this used to throw an exception.

    So if you don't want a parent for your dialog, you don't have to create a dummy one any more!! Doesn't it sound cool?

    In addition to this, there are some interesting facts that are worth mentioning -

    If the parent-less dialog is document-modal:
    A document-modal dialog without an owner would automatically become a root of the document and hence its scope of blocking is empty. So it behaves just like a modeless dialog.

    If the parent-less dialog is application or toolkit modal:
    The scope of blocking for an application or toolkit-modal dialog (as opposed to a document-modal dialog) doesn't depend on its owner and hence there will be no impact on the scope of blocking.

    In any case, a modal dialog should always stay on top of the other top-level windows that it blocks. You can not change the modality type of an already visible dialog. If you do so, you need to hide it and show again so that the new modality type specified comes into effect.

    Are you excited to know more about this feature and it's usage? Please take a look at the technical article on the new Modality feature in Java SE 6 .


    Wednesday Feb 15, 2006

    What's cool in AWT on Java SE 6

    Having worked on the testing side of the AWT for the Java SE 6 release, I am really tempted to write about some of the cool AWT features that I came across in Java SE 6. We already have a feature-rich Swing and a solid AWT as part of the Java SE for writing some cool GUI and what AWT offers on Mustang would really be an extra icing on the cake.

    We come across so many different applications in our day-to-day life and each of them is unique in it's own way. Being a test engineer for Java, I always tend to compare each of these applications with our own Java apps to see how are we doing?!! (After all, that is part of my job isn't it?!). There are times where I have wondered how cool would it be to offer some of the cool features that some native apps provide, as part of the Java SE. Say for example - We use different types of Instant Messangers such as Yahoo, ICQ etc. When you minimize the main window, you don't see it on the taskbar. Instead it appears on the system tray. Well, we could just use that space for keeping something else right?

    When you open a native application such as StarOffice or Acrobat Reader it often tells you in some way at start-up how long it would take to oad the application (a progress bar?). Sometimes, apps may show a jazzy, funny splash screens with lots of animations. Likewise, we do come across many Hi-Fi games and we sometimes get addicted to it. But it would be interesting to see what would it take to implement them in Java ?!!.


    AWT has answered some of these questions by offering a SystemTray and a SplashScreen feature on Java SE 6. Now it is possible for any Java App to go live on the system tray and free-up some space on the taskbar (with very little effort, of course). So if your app takes little longer time for loading and you are afraid that you may not be able to retain the attention of the user till then (whose impatience brings up 10 other applications on the screen otherwise) or if you just want to engage your user with a nice animated comedy until your app kicks in, Here is the solution - AWT Splash Screens !!


    Having said that, I can not overcome the temptation of telling what these APIs offer to the Java community.
    Let's first see what a Tray Icon is -

    A tray icon is a small icon represented by an image that can be added to the SystemTray on the desktop. A system tray on Microsoft Windows is often referred to as the "Taskbar Status Area", on Gnome it is referred to as the "Notification Area" and on KDE it is referred to as the "System Tray". The system tray is shared by all applications running on the desktop. A tray icon may optionally include a popup menu and a tooltip.

    System Tray screenshot
    System Tray on Windows XP

    So using Java SE 6, now you can add a Java tray icon to the system tray with an optional Tooltip / popup menu. You don't have to keep your app on the taskbar anymore (This feature is not entirely new to Java Community since it was there on JDIC before).

    What does Java Tray Icon offer you?
    - Add a popup menu and exercise the necessary actions without bringing up the application on the screen.
    - Display a tooltip on mouse rollover
    - Display a balloon message whenever necessary (could typically be error, info, warning or general)
    - Have animation on the tray icon by using an animated GIF image
    - Use GIF, JPEG and PNG images of varying transparency and change the images whenever you wish
    - Track Mouse Events, Action Events triggered by the tray icon, balloon message
    - Get notified when tray icon gets removed from the notification area
    - Add as many icons as you would require
    AND MUCH MORE...

    Message on a java tray icon
    Java Icon displaying a balloon message

    Popup Menu on a Java Tray Icon
    Java Icon with a Popup Menu

    The java icons will be removed automatically when the JVM exits and you don't have to worry about removing them yourself.

    Wait a moment !! If you are an applet developer, remember that the tray icon will require 'accessSystemTray' AWT Permission in order to be used from within the applet. Before all that, make sure SystemTray is supported on your platform by calling SystemTray.isSupported.

    Refer  java.awt.SystemTray , java.awt.TrayIcon for more details. Also don't forget to look at the technical article on SystemTray.

    So download the latest Mustang bundle and Get your java apps live on the system tray.

    Coming to Splash Screens, now AWT facilitates showing a 'creative' and a customizable splash screen for a Java application at the start-up, with a command line switch.
    For Example:
    java -splash:<img file> abc

    where 'abc' is the name of the class you want to launch. The splash screen would stay on the screen until your application opens up a window or you close it by yourself from within the application.

    (If your application is a packaged jar file, you could use the 'SplashScreen-Image' in the manifest file to make use of the splash screen feature)
    AWT gives you control to the Splash Screen through java.awt.SplashScreen class.

    Wondering what else could be exciting in a Splash Screen? - Here you go!!
    - Supports GIF, JPG PNG Images
    - Supports Translucency and Animation
    - Get a handle to the splash screen and get it's location and size.
    - Draw anything on top of the image (a progress bar?) through the Graphics2D object
    - Close the splash screen through the application
    - Change the image displayed in the splash screen to something cool

    Remember that you can only control the splash screen already specified, through the SplashScreen API and you can not create a new one. Please refer the Splash Screen technical article for more information.

    So get some cool animations right on the splash screens for your Java App with extremely little effort and make it more interesting for the end user.

    More to come .....

    About

    mohanpraveen

    Search

    Categories
    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