본문 바로가기

Development

NetBeans Wiki: JavaFXApplet

넷빈즈 위키에 있는 JavaFX 튜토리얼을 의역해봤습니다. 잘못된 부분 지적 주셔요.

My first JavaFX Applet

이 튜토리얼은 어떻게 드래그 가능한 자바FX 애플릿을 만드는지를 보여줍니다. 이 애플릿은 브라우저 밖으로도 드래그가 가능하다네요. 또 브라우저가 종료되어도 애블릿은 남아있습니다. This tutorial shows how you configure a draggable JavaFX Applet. A draggable applet can be dragged out of the web browser, and it keeps running even after the browser is closed. When you quit the Applet, you can reopen it via a shortcut from the Windows explorer like any other desktop application.

준비 사항
Pre-requisities
  1. Firefox 3.0 (or IE 7)
  2. JRE 6u10
  3. NetBeans with JavaFX plugins

파폭이나 익스플로러의 자바 가상머신이 반드시 JRE6 의 업데이트 10 버전이 필요합니다. Make sure Firefox or IE7 is your default browser and it uses the JRE 6u10!

단축 아이콘 기능을 위해 제어판의 자바 컨트롤에서 단축아이콘 생성 기능을 켜두셔야합니다. For the Store as Shortcut feature, go to Control Panel of your Java Control Panel -> Advanced tab -> Shortcut Creations and set the radio button to prompt user (or something similar).

이제 넷빈즈를 열어서 어플리케이션을 만들어보자구요
Create a simple JavaFX application
  1. 넷빈즈 시작~
    Start NetBeans 6.1 with JavaFX
  2. 자바FX 프로젝트 > 자바 FX 스크립트 어플리케이션 선택
    Go to File | New Project | JavaFX | JavaFX Script Application, Next, Finish
  3. Main.fx 파일 탭이 생성되었죠.
    A new JavaFX project is created and Main.fx is opened
  4. 어플리케이션 파레트에서 Application 항목을 드래그해 집어 코드를 생성시킵니다.
    Drag and drop the item Applications | Application from the palette to the editor
    Application
  5. 자동으로 코드가 생성되는군요.
    Drag and drop the item Text from the Palette to the content of the application in the editor
    Text
  6. 프로젝트 설정을 위해 지금 자바 FX 프로젝트를 오른 클릭하여 프로퍼티 창을 열어봅시다.
    Open project properties by right-clicking on the project in the Projects window.
  7. 어플리케이션 > 애플릿 항목을 선택하고 아래의 4가지를 모두 체크~
    Go to the Applet category and check:
    1. Run Applet in browser
    2. use JavaScript
    3. from jnlp file
    4. draggable
  8. 확인
    Confirm by clicking OK
    Applet properties
  9. 프로젝트 창에서 지금 편집한 Main.fx 파일에 오른 클릭~
    Right click on the Main.fx in the Project window.
  10. Run Applet 을 선택하여 어플리케이션 실행
    Click 'Run Applet' from the context menu
    Run applet
  11. 애플릿이 브라우저를 통해 실행됩니다.
    The Applet will start in the browser.
  12. ALT 키를 누른 채 브라우저 밖으로 애플릿을 이동시킬 수 있습니다.
    Press and hold Alt key and drag the applet out of the browser window.
  13. 브라우저를 종료할때 단축아이콘 생성할까요? 물어봅니다.
    Close the browser and it will ask you to store the applet as a shortcut.
  14. 브라우저를 종료해도 애플릿은 남아있네요.
    Note how the Applet keeps running even after the browser is closed.
자 다른 일에 응용해봅시다.

NetBeans Wiki: JavaFXApplet