Prepare

Prepare Your JavaFX Journey

Required Tools

JavaFX는 자바에 포함되므로 별도의 SDK는 필요없다. Java API는 http://www.oracle.com/technetwork/java/javase/downloads/index.html에서 다운받을 수 있다. 여기에는 JavaFX 애플리케이션의 개발, 실행 그리고 패키징에 필요한 모든 것이 들어 있다. Java8 SDK에 있는 커맨드 명령으로 컴파일도 가능한다.

그러나 대부분의 개발자들은 IDE를 사용하여 JavaFX 개발을 할 수 있다.

SceneBuilder는 단독 도구로서 JavaFX 인터페이스를 디자인할 수 있다. FXML이 만들어지며 이것에 대해서는 3장에서 다룬다. 이 도구는 http://www.oracle.com/technetwork/java/javase/downloads/sb2download-2177776.html에서 다운받을 수 있다.

JavaFX, the Community

JavaFX is not a closed-source project, developed in a secret bunker. To the contrary, JavaFX is being developed in an open spirit, with an open source code base, open mailing lists, and an open and active community sharing knowledge.

The source code is developed in the OpenJFX project, which is a subproject of the OpenJDK project in which Java SE is being developed. If you want to examine the source code or the architecture, or if you want to read the technical discussions on the mailing list, have a look at http://openjdk.java.net/projects/openjfx.

The developer community is very active, both in OpenJFX as well as in application-specific areas. The starting point for developers is the JavaFX Community at http://javafxcommunity.com. This is a community site created by Oracle, but with input from many JavaFX developers. The content of the JavaFX Community changes often, and in Figure 1-2 we show a snapshot on how this community site looked at the time of writing.

Figure 1-2. A snapshot of the JavaFX community web site

Use the Official Specifications

While developing JavaFX applications, it is very useful to have access to the API JavaDoc documentation, which is available at http://download.java.net/jdk8/jfxdocs/index.html and shown in Figure 1-3.

ScenicView

You already downloaded SceneBuilder, which is the tool that allows you to create UIs by designing them, rather than writing code. We expect that there will be more tools developed by companies and individuals that help you create JavaFX applications.

One of the first tools that was made available for free and that is very helpful when debugging JavaFX applications is ScenicView, originally created by Amy Fowler at Oracle, and later maintained by Jonathan Giles. You can download ScenicView at http://fxexperience.com/scenic-view/.

ScenicView는 실행시 노드의 특성(크기,위치,CSS)을 검사하기 편리한 UI를 제공한다.

패키징과 배포

사용자에게 소프트웨어를 전달하는 기법들은 항상 변해왔다. 과거에 자바 애플리케이션은 JNLP를 통하는 방법을 선호했다. 애플릿과 단독 애플리케이션 모두 클라이언트 상에 설치될 수 있다. 하지만 이 기법은 여러가지 이슈가 있다. 최종 사용자가 알맞는 JVM이 설치되어 있다는 가정하에서만 가능하다.

하지만 항상 그런것은 아니다. JVM이 설치되어 있다 하더라도 버전이나 보안 문제가 이슈가 된다. 실제로 어떤 애플리케이션은 특정 버전의 JVM을 요구하도록 하드코딩되어 있다. JVM의 침해에 대해 매우 빠른 수정에도 불구하고 여전히 최종 사용자는 항상 최신 버전의 JVM이 설치되어야 하며 이는 매우 좌절스러운 상황이 될 수 있다.

On top of that, browser manufacturers are increasingly reluctant to support alternative embedded platforms. In summary, relying on a browser and on a local, preinstalled JVM does not provide the best end-user experience.

The client software industry is shifting more and more toward the so-called AppStores. In this concept, applications can be downloaded and installed that are self-containing. They do not rely on preinstalled execution environments. The principles originated in the mobile space, where Apple with the AppStore and Android with the Play store are leading the market. Especially in these markets, single-click installs have a huge advantage over local downloads, unpacking, manual configuration, and more nightmares.

In Java terminology, a self-contained application means that the application is bundled together with a JVM that is capable of running the application. In the past, this idea was often rejected because it made the application bundle too big. However, with increasing memory and storage capacities, and with decreasing costs of sending bytes over the Internet, this disadvantage is becoming less relevant.

여러분의 애플리케이션과 이에 맞는 JVM버전을 묶어서 패키징하도록 개발된 여러 기법들이 있다. JavaFXPackager는 OpenJFX 프로젝트에서 개발되며 스스로 포함된 번들을 만드는 API를 제공한다.

메이븐 사용자는 http://zenjava.com/javafx/maven/을 사용하여 JavFX 번들을 만들 수 있다. 툴이 설치되었다면 “Hello Earthrise" 프로젝트에서 애플리케이션을 self-cotained 번들로 만드는 방법을 시연할 것이다.