DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations

Trending

  • Mastering Time Series Analysis: Techniques, Models, and Strategies
  • Auditing Tools for Kubernetes
  • Top 10 Engineering KPIs Technical Leaders Should Know
  • SRE vs. DevOps

Trending

  • Mastering Time Series Analysis: Techniques, Models, and Strategies
  • Auditing Tools for Kubernetes
  • Top 10 Engineering KPIs Technical Leaders Should Know
  • SRE vs. DevOps
  1. DZone
  2. Coding
  3. Java
  4. NetBeans Platform Development in JavaFX!

NetBeans Platform Development in JavaFX!

Geertjan Wielenga user avatar by
Geertjan Wielenga
·
Mar. 19, 10 · News
Like (0)
Save
Tweet
Share
22.81K Views

Join the DZone community and get the full member experience.

Join For Free

The NetBeans team is busy enabling NetBeans Platform developers to integrate JavaFX components into their applications.

Since there is no official way of accessing JavaFX from Swing, the NetBeans team will provide open-sourced API equivalents of JavaFX components. Developers will be able to include the Open API JavaFX library in their NetBeans Platform applications. Currently, this is what the API looks like:

The above API enables you to code your NetBeans modules purely in JavaFX. As an example of using NetBeans APIs in a pure JavaFX module, this code would display a NetBeans TopComponent containing all the JavaFX demos (which extend the "DemoPart" class) registered in the NetBeans Lookup:

var lkp = Lookup {type: org.netbeans.modules.javafx.example.DemoPart.class};

var tc = SceneTopComponent {
   name: "Installed demos"
   scene : Scene {
       width: 1000
       height: 800
       content: [
               Flow {
                   hgap: 20, vgap: 20
                   padding: Insets {
                       bottom: 20, left: 20, right: 20, top: 20
                   }                 
                   content: bind for (demo in lkp.result) DemoNode {demo: demo as DemoPart}
               }
           ]
   }
}

tc.display();
A new project template will be provided in NetBeans IDE. It will have an enriched build.xml file, containing an Ant script that will enable the above code to be compiled to bytecode. The required dependencies, such as to the JavaFX SDK, will also be predefined in the template.

Within the support class in the API shown above, the JavaFX components are mapped to Java. For example, an Action is part of the support class. Therefore, in the layer of the module where you'd like to use the Action, you create an Action instance like this:

  <folder name="Menu">
      <folder name="Window">
           <folder name="Other">
               <file name="ShowFXDemo.instance">
                   <attr name="instanceClass" stringvalue="javax.swing.Action"/>
                   <attr name="instanceCreate" methodvalue="org.netbeans.javafx.Support.action"/>
                   <attr name="action" stringvalue="org.netbeans.modules.javafx.example.Action"/>
                   <attr name="displayName" bundlevalue="org.netbeans.modules.javafx.example.Bundle#ShowFXDemo"/>
               </file>
           </folder>
       </folder>
   </folder> 

On the basis of the above, the three demos below have been created:

Above you see three demos, each created in JavaFX and integrated into a NetBeans Platform "TopComponent", i.e., a window in a NetBeans Platform application. For example, this is the definition of "Demo1" above:

package org.netbeans.modules.javafx.example;

import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import javafx.scene.layout.Panel;
import javafx.scene.layout.LayoutInfo;

public class Demo1 extends DemoPart {

   public override function create() {
       var n = Rectangle {
           layoutX: 25 layoutY: 25
           width: 50, height: 50
           fill: Color.GREEN
           rotate: 10
       }
Panel {
layoutInfo: LayoutInfo { width: 100 height: 100 }
content: [n]
       }
   }

}

The NetBeans team is looking for feedback to this new development, as well as for your usecases. They will also be submitting a paper to JavaOne around this theme. 

 

NetBeans JavaFX

Opinions expressed by DZone contributors are their own.

Trending

  • Mastering Time Series Analysis: Techniques, Models, and Strategies
  • Auditing Tools for Kubernetes
  • Top 10 Engineering KPIs Technical Leaders Should Know
  • SRE vs. DevOps

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: