JFXStudio: sketch, hack, share

Reversi

Posted by: Sergey Malenkov on: August 13, 2010

I developed my first implementation of the Reversi game on BASIC 20 years ago. Since then, I ported it on each programming language I studied: Turbo Pascal with graphics library and Turbo Vision, C with the Windows API, C++ with the ClanLib, Java AWT applet, and Swing application with Java2D. Now I am ready to publish yet another implementation, on JavaFX Script.


Reversy 8×8

Reversy 10×10

This game allows to compete with one of the algorithms as well as to see how these algorithms compete with each other. The Sergey algorithm is based on the Minimax algorithm with a simple table of game piece weights where the calculation depth is 6. The Pavel algorithm is developed by my colleague, and I have got it from the official JavaFX site.

I run the algorithm competition during the past weekend. Below are the results:

  • Pavel versus Sergey: 5653 wins, 363 draws, 8605 losses;
  • Sergey versus Pavel: 8563 wins, 299 draws, 6612 losses.

In addition, I discovered that my algorithm is often wins, turning all the opponent’s pieces. The reason is that Pavel uses an algorithm to minimize available moves of the opponent. He promised to complete the evaluation function soon.

Would you like to join the battle of algorithms?

Tags: ,

JavaFX Animation (No image included)

Posted by: Mark Anro Silva on: July 30, 2010

The Beauty of JavaFX(100% JavaFX).



Tags:

Matchstick Graph Editor

Posted by: karussell on: May 10, 2010

Recently I created  a specialized graph editor for matchstick graphs like the Harboth graph. It is not a fancy application but it works:

Try it out and load the data of the harboth graph into your editor!

Question: What is the minimal 1, 2 and 3-degree-matchstick graph in 2D?

Requirements:

  • In a 3 degree graph every node has exactly 3 edges
  • It must be a planar graph (edges can only intersect at the nodes)
  • Length of each edge is the same
  • Be the first and link to your matchstick.dat file(s)
  • Think about solutions for 1, 2, 3 and 4 degree matchstick graphs in 3D (easier than 2D)

Prizes: Win Experience and be listed here as a winner ;-) !

Conclusion

Getting starting and done was easy and fast within some hours. But debugging and writing tests in JavaFX (1.2 or 1.3) with NetBeans is not that good as described earlier :-/

backlink to original article from karussell

TimeShot – JFX photography post-production tool

Posted by: diazcardoso on: May 5, 2010

Painting with photos, that’s the simple concept that this new tool proposes. Using a collection of photos, from two to almost 17 million – if your computer memory allows it – the user can draw shapes with gradients of the photo collection itself, blending from one photo to the other.


Imagine creating a photo from a timelapse photo set of a sunset where on one side it’s still day and on the other is already night. That is only one usage. TimeShot is merely a post-production tool that photographers can use and along with some imagination create amazing results.
Other usages could be:

  • Simulate a camera filter to make sky and ground visible on a sunny day;
  • Use multi-focus photos of the same subject and create a photo with several focus spots at different distances;
  • Bend two or more pictures;
  • Use a slow motion film to create an imagine of the objects distorted; and much more..

The easiest way to wrap around this new concept is to view it:

TimeShot was developed initially to test the performance on several RIA plataforms, like JavaFX, Flex/AS3 and Javascript for a bigger project at inEvo.The test had to be very demanding in terms of 2D graphics manipulation, 2D scene graph and 2D rendering pipeline. On the other hand, loading a great amount of photos and rendering a photo that is composed of  - eg. – 5000 12 megapixel photos isn’t just CPU heavy but has still to be somehow responsive to the user.

As Javascript and Flex performed ok in terms of 2D graphics, JavaFX performed a bit better and gave much more possibilities in terms of the type of manipulations we could do with the render system.
As far as the batch processing goes, although there are some projects out there that try to simulate background threading for flash – green thread -, they make the process slower and usually, the application would just stopped while loading or rendering.

JavaFX had a big advantage in this field with the usage of threads. Multi threads were used in more hardcore processing like photo loading, photo rendering and on the rendering of the main canvas. It makes everything run faster, more responsive was simple and straightforward to implement.

With all these advantages on JavaFX side, we took it “a bit” more far then just a technology test and developed a full featured application.

You can run it with Java Web Start or embed in your browser, just go over to TimeShot site.

java web start - Timeshot

A Google Translate Service Client

Posted by: William Antônio Siqueira on: May 3, 2010

TranslateFX is a little app done in JavaFX that allows the user to use the Google Translator Service.

The Google Translate API

The Google Translate API is simple. There’s two ways to use the API: A javascript library or the REST way.

The REST way receive three attributes: The version, the language pair and the text to be translated. The response is in JSON format.
You can make a HTTP GET request to below URL to see the response:

http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=hello%20world&langpair=en%7Cit

For more information about the API check out the official documentation.

Acessing the service with JavaFX

It was so simple use JavaFX to access the service. A class called Translator was created to use the translate service independently. The languages that will be available to use in the app are in a JavaFX file apart.

The UI use some of JavaFX 1.3 new controls and a little JavaFX CSS file. It is not necessary to press the Translate button to translate, just type! Run it in applet mode.

Run it!

Get It!

Download Source

New Desktop Experience

Posted by: karussell on: April 22, 2010

Via twitter from Jonathan I recognized that one can be a guest author here at the jfxstudio blog if you like to share your JavaFX example. So I am taking that opportunity to link back to my about page and to show you how I realized my simple desktop idea with JavaFX.

In a long post I explained in how I developed the idea of a simpler desktop. Here I will show you directly the results achieved with JavaFX.

Unified Taskbar

First of all here is a screenshot of the centered unified taskbar:

The taskbar shows up if you press the ALT key. In a real window manager like gnome or kde this would be done with the ubuntu key. I called it unified because you can switch the applications on mouse over (normally triggered via ALT+TAB) or use it as a normal taskbar (e.g. accessing the desktop window).

Desktop Has Two States

My desktop UI has two states:

  • Application state [released ALT key] where one or more windows are shown (normally only one windows is in full screen)

  • Editing state [pressed ALT key] where the taskbar is shown and all application windows are shaded out

In editing state we can switch, close, resize and move windows. To close an application we could put a small ‘close’-icon  – like it is the case for tabs for your browser – on each icon of the unified taskbar. At the moment the JavaFX version only implements switching windows (ALT + RIGHT/LEFT). There is one special window – the desktop – which is always fullscreen and cannot be closed, resized or moved.

With that in mind the bars on the top of each application window are not necessary any longer. So the applications could then be always full screen like it is the case for mobile devices.

Desktop Background as a Window

We needed to introduce the desktop background as a special window available from the taskbar. All your small icons which normally resides in the taskbar and other mini-apps could go there. For my desktop background I will steal the idea of docks from my current window manager called Window Maker. One important dock will be a finder-menu where you can access your applications via tags very fast and easily. Another dock is the log-off dock which enables you to go to your offline world faster. All docked apps could be arranged via dragging like the user wants it. So now look at the resulting desktop background

JavaFX Components

I implemented some components which should be more or less reuseable:

  • FilterList shows only a subset of an item sequence
  • draggable Docks like the FindDock

  • the IconDock
  • or the LogOffDock


    All docks will be enlarged on mouse over and if you specify a maxSize larger than the minSize:


  • DesktopBar shows all items and makes the selected item bigger
  • a small Notification field which is a text field with colored background and disapears after some time (see in the log-off dock)

Some things are currently not implemented in the JavaFX application:

  • Closing, resizing and dragging of windows in the editing state
  • If the user hits ENTER in the find-menu dock it should start that command and if this command does not exist it will start a desktop search
  • ALT+TAB does not work with JavaFX so I had to use ALT+LEFT and ALT+RIGHT
  • The current time could be displayed instead of an icon for the desktop

Conclusion

I would really like to see some of my ideas in Kde or Gnome. Or gnome-do should replace all the unnecessary bars. In my humble opinion those ideas are simplifications and usage boosts and not only eye catchers like the most UI ‘improvements’ were in the last time … keyword: compiz.

See deeper !

Get it !

Clone the latest and greatest status of the project here:

hg clone http://timefinder.hg.sourceforge.net:8000/hgroot/timefinder/desktopbar/

[The source code is under public domain. The icons and images mustn't be reused. Works with JavaFX1.2 and 1.3 (minor code changes necessary)]

JavaFX Light Bulb

Posted by: Mark Anro Silva on: April 21, 2010

This is a JavaFX example that shows on how JavaFX can make a regular Image more realistic.
You can also control the opacity of the light by sliding the slider.



Source Code

JavaFX Effect Example

Posted by: Mark Anro Silva on: April 19, 2010

This is a JavaFX logo that has three-dimensional glowing effect. The Java logo (cofee cup and smoke) is also made in javafx with a glow and lightning effect of javafx. Glow and Lighting are subclasses of abstract base class javafx.scene.effect.Effect.


Source Code

JFXcube – try to solve it!

Posted by: kaikfx on: March 3, 2010

When I heard about first JavaFX challenge, I decided to participate with some application that can show how powerful this language is. In order to do that, I created my own version of Rubik’s Cube game. Now, after upgrading it to JavaFX 1.2 version, I wish to share it with you.

I think there’s nothing to say about how the game works. Everybody knows that when cube faces are messy it’s really difficult to put them right, so that’s the target.
If the left bottom cube button is selected, you can drag around the big cube to look at it from different perspectives. Otherwise, if you select the bottom-right cube button, you can rotate one “slice” of the cube.

Inside menu options, there is the scrambler function, besides other options. I’m not sure but I think that save/load options have been damaged when moving from JFX 1.0 to JFX 1.2, so probably they won’t work.

Taking into account that I’ve not used any kind of 3D engine, the complexity of the project is elevated, so I’m not going to detail how the game has exactly been developed. Anyway, for those who can be more interested, the key point is to extend from Polygon class for each one of the colored faces, in order to relate them with their 3D points, so the movement can be applied directly into the points. Maybe reading VideoCube example, in javafx webpage, can help understanding a little bit how all that works, because the concept is similar althought that example is smaller.

Enjoy it!

Click here to lauch JNLP

APPLET on kaikreations

My Experiments with JavaFX

Posted by: gyanlabs on: February 1, 2010

I started experimenting with JavaFX1.2. I felt writing complex special effects or writing Animation code in JavaFX is very simple. In a very short time I am able to produce complex visual effects which previously took days to create in Java 2D.

Check out the following Animation.I am using Netbeans 6.8 and Inkscape 4.7 for creating Vector images.

(Note that my primary interest in creating this Animation is to learn JavaFX Script, I have not optimized it for performance or start up time. Code is not clean as there are lot of unnecessary methods and animation logic,  I will publish the cleaned source soon.)

You can click on it and create more plants.

Java Web Start (save this Java webstart JNLP file and run it)

Java Applet