Home » Java » Desktop Java » Page 24

Desktop Java

JavaFX 2.0 and Scala, Like Milk and Cookies

JavaFX 2.0 and Scala are both great technologies individually, but work even better when used together. JavaFX 2.0 is a powerful rich client technology with advanced graphics, animation, and media capabilities. Scala is a simple, yet powerful language with advanced language features for writing domain-specific languages (DSLs). Add a little Scala UI DSL to your JavaFX 2.0 project and you ...

Read More »

JavaFX 2.0 Bar and Scatter Charts (and JavaFX 2.1 StackedBarCharts)

JavaFX 2.0 provides built-in capabilities for generating charts, a capability found within the javafx.scene.chart package. In this post, I look at creating bar charts and a scatter chart in using JavaFX 2.0. During the course of this post, I use Guava and some Java 7 features along the way. Before demonstrating the JavaFX 2.0 chart APIs, this first code listing ...

Read More »

Building Games Using the MVC Pattern – Tutorial and Introduction

One useful architecture pattern in game development is the MVC (model-view-controller) pattern. It helps separate the input logic, the game logic and the UI (rendering). The usefulness is quickly noticeable in the early stages of any game development project because it allows to change things quickly without too much rework of code in all layers of the application. The following ...

Read More »

PopupMenu in JavaFX 2

Creating Popup Menus To create a Popupmenu in JavaFX you can use the ContextMenu class. You add MenuItems to it and can also create visual separators using SeparatorMenuItem. In the example below I’ve opted to subclass ContextMenu and add the MenuItems on its constructor. public class AnimationPopupMenu extends ContextMenu{ public AnimationPopupMenu() { (...) getItems().addAll( MenuItemBuilder.create() .text(ADD_PARTICLE) .graphic(createIcon(...)) .onAction(new EventHandler() { ...

Read More »

Java Swing Tic-Tac-Toe

Hello people! Wow its been a while since I posted something here…! I must say I really miss writing stuff and I promise I wont get into a ‘writer’s block’ again. Hopefully .. A helluva lot of things happened in the last two months and I’ve got loads to say. But in this post Im just gonna publish a small ...

Read More »

Graphics Tutorial

As we all know that we can make games with the help of java libraries that provide us with the graphics needed for making them. So today I will be starting a very new section on Java Graphics. I had earlier made posts on How to make an income tax calculator. To start with here are some prerequisites : -You ...

Read More »

Book Review: JavaFX 2.0: Introduction by Example

Although Oracle’s changes to JavaFX at JavaOne 2010 and JavaOne 2011 have converted me from a skeptic to a believer when it comes to JavaFX, the shift in JavaFX vision has not been without its downsides. In particular, the JavaFX book market has been tricky because nearly all available JavaFX books have been about version 1.x. In this post, I ...

Read More »

Integrating JavaFX 2.0 with Swing and SWT

One of the improvements in JavaFX with JavaFX 2.0 has been greater ease of interoperability with Swing and SWT. Several online resources document how this is done. These include Integrating JavaFX into Swing Applications and SWT Interop. However, in a nice example of effective class-level Javadoc documentation, the respective JavaFX classes javafx.embed.swing.JFXPanel and javafx.embed.swt.FXCanvas each provide a simple code sample ...

Read More »