title: Using JavaFX DatePicker in Eclipse SwingBuilder
body: <p>I'm trying to design an application using a combination of JavaFX and Swing components, initially I created a Swing project and am trying to integrate a JavaFX <code>javafx.scene.control.DatePicker</code> control.</p>
  
  <p>I read elsewhere that I should be able to do this with a <code>javafx.embed.swing.JFXPanel</code> so I created a new <code>JPanel</code> and using Eclipses WindowBuilder added a <code>JFXPanel</code> but when I added a <code>DatePicker</code> Eclipse throws an error.</p>
  
  <p>I am using the latest version of JRE/JDK.</p>
  
  <p>The code looks like this;</p>
  
  <pre><code>import javax.swing.JPanel;
  import javafx.embed.swing.JFXPanel;
  import javafx.scene.control.DatePicker;
  
  public class test extends JPanel {
      /**
       * @wbp.nonvisual location=99,99
       */
      private final DatePicker datePicker = new DatePicker();
  
      /**
       * Create the panel.
       */
      public test() {
  
          JFXPanel panel = new JFXPanel();
          add(panel);
  
      }
  
  }
  </code></pre>
  
  <p>When I look at the design view;</p>
  
  <pre><code>Exception during constructor evaluation
  
  An exception happened during evaluation of
  
  new DatePicker()
  Constructor DatePicker() was used with the parameters {}. 
  Note: null values may occur when parsing complex expressions that can't be resolved at design-time. java.lang.NoClassDefFoundError: Could not initialize class javafx.scene.control.DatePicker
  
  
  
  
  
  Hide stack trace. 
  
  
  
  Stack trace:
  org.eclipse.wb.internal.core.utils.exception.DesignerException: 307 (Exception during constructor evaluation). new DatePicker() DatePicker() {} java.lang.NoClassDefFoundError: Could not initialize class javafx.scene.control.DatePicker
      at org.eclipse.wb.internal.core.eval.evaluators.InvocationEvaluator.createConstructorProblemException(InvocationEvaluator.java:593)
      at org.eclipse.wb.internal.core.eval.evaluators.InvocationEvaluator.evaluate(InvocationEvaluator.java:268)
      at org.eclipse.wb.internal.core.eval.evaluators.InvocationEvaluator.evaluate(InvocationEvaluator.java:81)
      at org.eclipse.wb.core.eval.AstEvaluationEngine.evaluate0(AstEvaluationEngine.java:177)
      at org.eclipse.wb.core.eval.AstEvaluationEngine.evaluate(AstEvaluationEngine.java:61)
      at org.eclipse.wb.internal.core.model.JavaInfoEvaluationHelper.evaluateExpression(JavaInfoEvaluationHelper.java:630)
      at org.eclipse.wb.internal.core.model.JavaInfoEvaluationHelper.evaluate(JavaInfoEvaluationHelper.java:502)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser.evaluateNode(JavaInfoParser.java:1309)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser.access$1(JavaInfoParser.java:1300)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser$ExecutionFlowParseVisitor$3.run(JavaInfoParser.java:602)
      at org.eclipse.wb.internal.core.utils.execution.ExecutionUtils.runRethrow(ExecutionUtils.java:119)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser$ExecutionFlowParseVisitor.postVisit(JavaInfoParser.java:592)
      at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2714)
      at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2759)
      at org.eclipse.jdt.core.dom.VariableDeclarationFragment.accept0(VariableDeclarationFragment.java:263)
      at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711)
      at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2782)
      at org.eclipse.jdt.core.dom.FieldDeclaration.accept0(FieldDeclaration.java:289)
      at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711)
      at org.eclipse.wb.core.eval.ExecutionFlowUtils.visitFields(ExecutionFlowUtils.java:267)
      at org.eclipse.wb.core.eval.ExecutionFlowUtils.visit(ExecutionFlowUtils.java:223)
      at org.eclipse.wb.core.eval.ExecutionFlowUtils.visit(ExecutionFlowUtils.java:191)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser.parseRootMethods(JavaInfoParser.java:312)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser.parse(JavaInfoParser.java:268)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser.access$9(JavaInfoParser.java:238)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser$1.runObject(JavaInfoParser.java:153)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser$1.runObject(JavaInfoParser.java:1)
      at org.eclipse.wb.internal.core.utils.execution.ExecutionUtils.runDesignTime(ExecutionUtils.java:159)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser.parse(JavaInfoParser.java:151)
      at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF(DesignPage.java:534)
      at org.eclipse.wb.internal.core.editor.DesignPage.access$9(DesignPage.java:522)
      at org.eclipse.wb.internal.core.editor.DesignPage$8$1.run(DesignPage.java:449)
      at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:186)
      at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:145)
      at org.eclipse.swt.widgets.Display.syncExec(Display.java:4761)
      at org.eclipse.wb.internal.core.editor.DesignPage$8.run(DesignPage.java:446)
      at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:463)
      at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:371)
      at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:500)
      at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF_withProgress(DesignPage.java:465)
      at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF(DesignPage.java:415)
      at org.eclipse.wb.internal.core.editor.UndoManager.refreshDesignerEditor(UndoManager.java:381)
      at org.eclipse.wb.internal.core.editor.UndoManager.activate(UndoManager.java:90)
      at org.eclipse.wb.internal.core.editor.DesignPage.handleActiveState_True(DesignPage.java:263)
      at org.eclipse.wb.internal.core.editor.DesignPage.handleActiveState(DesignPage.java:241)
      at org.eclipse.wb.internal.core.editor.multi.DefaultMultiMode.showPage(DefaultMultiMode.java:125)
      at org.eclipse.wb.internal.core.editor.multi.DefaultMultiMode$1.widgetSelected(DefaultMultiMode.java:63)
      at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1137)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1122)
      at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:788)
      at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3158)
      at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1841)
      at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:330)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)
      at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4180)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3769)
      at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
      at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
      at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
      at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
      at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:654)
      at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
      at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:598)
      at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
      at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139)
      at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
      at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
      at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
  Caused by: java.lang.NoClassDefFoundError: Could not initialize class javafx.scene.control.DatePicker
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at org.eclipse.wb.internal.core.eval.evaluators.InvocationEvaluator.evaluate(InvocationEvaluator.java:262)
      ... 81 more
  
  
  Full context stack trace:
  java.lang.Error: new DatePicker()
      at org.eclipse.wb.core.eval.AstEvaluationEngine.evaluate(AstEvaluationEngine.java:71)
      at org.eclipse.wb.internal.core.model.JavaInfoEvaluationHelper.evaluateExpression(JavaInfoEvaluationHelper.java:630)
      at org.eclipse.wb.internal.core.model.JavaInfoEvaluationHelper.evaluate(JavaInfoEvaluationHelper.java:502)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser.evaluateNode(JavaInfoParser.java:1309)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser.access$1(JavaInfoParser.java:1300)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser$ExecutionFlowParseVisitor$3.run(JavaInfoParser.java:602)
      at org.eclipse.wb.internal.core.utils.execution.ExecutionUtils.runRethrow(ExecutionUtils.java:119)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser$ExecutionFlowParseVisitor.postVisit(JavaInfoParser.java:592)
      at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2714)
      at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2759)
      at org.eclipse.jdt.core.dom.VariableDeclarationFragment.accept0(VariableDeclarationFragment.java:263)
      at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711)
      at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2782)
      at org.eclipse.jdt.core.dom.FieldDeclaration.accept0(FieldDeclaration.java:289)
      at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711)
      at org.eclipse.wb.core.eval.ExecutionFlowUtils.visitFields(ExecutionFlowUtils.java:267)
      at org.eclipse.wb.core.eval.ExecutionFlowUtils.visit(ExecutionFlowUtils.java:223)
      at org.eclipse.wb.core.eval.ExecutionFlowUtils.visit(ExecutionFlowUtils.java:191)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser.parseRootMethods(JavaInfoParser.java:312)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser.parse(JavaInfoParser.java:268)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser.access$9(JavaInfoParser.java:238)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser$1.runObject(JavaInfoParser.java:153)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser$1.runObject(JavaInfoParser.java:1)
      at org.eclipse.wb.internal.core.utils.execution.ExecutionUtils.runDesignTime(ExecutionUtils.java:159)
      at org.eclipse.wb.internal.core.parser.JavaInfoParser.parse(JavaInfoParser.java:151)
      at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF(DesignPage.java:534)
      at org.eclipse.wb.internal.core.editor.DesignPage.access$9(DesignPage.java:522)
      at org.eclipse.wb.internal.core.editor.DesignPage$8$1.run(DesignPage.java:449)
      at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:186)
      at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:145)
      at org.eclipse.swt.widgets.Display.syncExec(Display.java:4761)
      at org.eclipse.wb.internal.core.editor.DesignPage$8.run(DesignPage.java:446)
      at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:463)
      at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:371)
      at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:500)
      at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF_withProgress(DesignPage.java:465)
      at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF(DesignPage.java:415)
      at org.eclipse.wb.internal.core.editor.UndoManager.refreshDesignerEditor(UndoManager.java:381)
      at org.eclipse.wb.internal.core.editor.UndoManager.activate(UndoManager.java:90)
      at org.eclipse.wb.internal.core.editor.DesignPage.handleActiveState_True(DesignPage.java:263)
      at org.eclipse.wb.internal.core.editor.DesignPage.handleActiveState(DesignPage.java:241)
      at org.eclipse.wb.internal.core.editor.multi.DefaultMultiMode.showPage(DefaultMultiMode.java:125)
      at org.eclipse.wb.internal.core.editor.multi.DefaultMultiMode$1.widgetSelected(DefaultMultiMode.java:63)
      at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1137)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1122)
      at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:788)
      at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3158)
      at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1841)
      at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:330)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)
      at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4180)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3769)
      at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
      at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
      at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
      at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
      at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:654)
      at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
      at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:598)
      at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
      at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139)
      at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
      at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
      at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
  Caused by: org.eclipse.wb.internal.core.utils.exception.DesignerException: 307 (Exception during constructor evaluation). new DatePicker() DatePicker() {} java.lang.NoClassDefFoundError: Could not initialize class javafx.scene.control.DatePicker
      at org.eclipse.wb.internal.core.eval.evaluators.InvocationEvaluator.createConstructorProblemException(InvocationEvaluator.java:593)
      at org.eclipse.wb.internal.core.eval.evaluators.InvocationEvaluator.evaluate(InvocationEvaluator.java:268)
      at org.eclipse.wb.internal.core.eval.evaluators.InvocationEvaluator.evaluate(InvocationEvaluator.java:81)
      at org.eclipse.wb.core.eval.AstEvaluationEngine.evaluate0(AstEvaluationEngine.java:177)
      at org.eclipse.wb.core.eval.AstEvaluationEngine.evaluate(AstEvaluationEngine.java:61)
      ... 78 more
  Caused by: java.lang.NoClassDefFoundError: Could not initialize class javafx.scene.control.DatePicker
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at org.eclipse.wb.internal.core.eval.evaluators.InvocationEvaluator.evaluate(InvocationEvaluator.java:262)
      ... 81 more
  </code></pre>
  
  <p>Is there a simple solution to getting this working, or perhaps I should use a different component for date time selection?</p>