OpenJFX - TreeTableView

Hi all,
I must develop a desktop application which should contain many tables. Especially I need "tree tables", where you can expand or collapse some rows.
Unfortunately I found that TreeTable is not implemented in JavaFx yet, while in Swing it was available. But I'd not be very glad to use Java Swing 'cause it's a little old... :(
So I'm trying to find a solution and I discovered the existence of OpenJFX and of a Sandbox which contains the TreeTableView component:
http://hg.openjdk.java.net/openjfx/sandbox-8/controls/rt
However I downloaded and imported it into Eclipse, but I get these build path errors:
Description     Resource     Path     Location     Type
Project 'OpenJFX' is missing required Java project: 'rt-closed'     OpenJFX          Build path     Build Path Problem
Project 'OpenJFX' is missing required source folder: 'javafx-ui-controls/build/builders'     OpenJFX          Build path     Build Path Problem
Project 'OpenJFX' is missing required source folder: 'javafx-ui-common/build/builders'     OpenJFX          Build path     Build Path Problem
Project 'OpenJFX' is missing required source folder: 'javafx-ui-charts/build/builders'     OpenJFX          Build path     Build Path Problem
Project 'OpenJFX' is missing required source folder: 'javafx-concurrent/build/builders'     OpenJFX          Build path     Build Path Problem
It seems that some folders are missing...
Can you help me please?
Thank you in advance.

up

Similar Messages

  • TreeTableView Scrollbar Not Responsive Once Node is Collapsed

    I've created a TreeTableView using a folder/file structure, I start all of the tree nodes to be expanded.  The vertical scrollbar does respond at that point as expected by scrolling the treatable content.  However, if I collapse one of the parent nodes the vertical scrollbar does not scroll the content consistently.  Sometimes it works and sometimes the content does not scroll at all, when I re-expand the node it still does not reset the vertical scrollbar.
    I'm using Java(TM) SE Runtime Environment (build 1.8.0-ea-b114) on Mac OSx Mavericks.

    package treetablescrollingbug;
    import java.io.File;
    import java.text.DateFormat;
    import java.text.NumberFormat;
    import java.util.Comparator;
    import java.util.Date;
    import javafx.application.Application;
    import javafx.beans.property.ReadOnlyObjectWrapper;
    import javafx.beans.value.ObservableValue;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.scene.Scene;
    import javafx.scene.control.TreeItem;
    import javafx.scene.control.TreeTableCell;
    import javafx.scene.control.TreeTableColumn;
    import javafx.scene.control.TreeTableView;
    import javafx.scene.layout.AnchorPane;
    import javafx.stage.Stage;
    import javafx.util.Callback;
    public class TreeTableScrollingBug extends Application {
        private final static NumberFormat NumberFormater = NumberFormat.getIntegerInstance();
        private final static DateFormat DateFormater = DateFormat.getDateTimeInstance();
        private TreeTableView<File> treeTblFolderStructure;
        @Override
        public void start(Stage primaryStage) {
            this.treeTblFolderStructure = new TreeTableView<>();
            this.buildFileBrowserTreeTableView();
            AnchorPane root = new AnchorPane();
            AnchorPane.setTopAnchor(this.treeTblFolderStructure, 10.0);
            AnchorPane.setLeftAnchor(this.treeTblFolderStructure, 10.0);
            AnchorPane.setRightAnchor(this.treeTblFolderStructure, 10.0);
            AnchorPane.setBottomAnchor(this.treeTblFolderStructure, 10.0);
            root.getChildren().add(this.treeTblFolderStructure);
            Scene scene = new Scene(root, 640, 480);
            primaryStage.setTitle("TreeTableView Vertical ScrollBar BUG");
            primaryStage.setScene(scene);
            primaryStage.show();
        private void buildFileBrowserTreeTableView() {
        TreeItem<File> root = createNode(new File("/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk"));
        root.setExpanded(true);
        this.treeTblFolderStructure.setShowRoot(true);
        this.treeTblFolderStructure.setRoot(root);
        // --- name column
        TreeTableColumn<File, String> nameColumn = new TreeTableColumn<File, String>("Name");
        nameColumn.setPrefWidth(300);
        nameColumn.setCellValueFactory(
                new Callback<TreeTableColumn.CellDataFeatures<File, String>, ObservableValue<String>>() {
            @Override
            public ObservableValue<String> call(TreeTableColumn.CellDataFeatures<File, String> p) {
                File f = p.getValue().getValue();
                String text = f.getParentFile() == null ? "/" : f.getName();
                return new ReadOnlyObjectWrapper<String>(text);
        // --- size column
        TreeTableColumn<File, File> sizeColumn = new TreeTableColumn<File, File>("Size");
        sizeColumn.setPrefWidth(100);
        sizeColumn.setCellValueFactory(new Callback<TreeTableColumn.CellDataFeatures<File, File>, ObservableValue<File>>() {
            @Override public ObservableValue<File> call(TreeTableColumn.CellDataFeatures<File, File> p) {
                return new ReadOnlyObjectWrapper<File>(p.getValue().getValue());
        sizeColumn.setCellFactory(new Callback<TreeTableColumn<File, File>, TreeTableCell<File, File>>() {
            @Override public TreeTableCell<File, File> call(final TreeTableColumn<File, File> p) {
                return new TreeTableCell<File, File>() {
                    @Override protected void updateItem(File item, boolean empty) {
                        super.updateItem(item, empty);
                        TreeTableView treeTable = p.getTreeTableView();
                        // if the File is a directory, it has no size...
    //                    if (getIndex() >= treeTable.impl_getTreeItemCount())
    //                        setText(null);
    //                    else
                            TreeItem<File> treeItem = treeTable.getTreeItem(getIndex());
                            if (item == null || empty || treeItem == null ||
                                    treeItem.getValue() == null || treeItem.getValue().isDirectory()) {
                                setText(null);
                            } else {
                                setText(NumberFormater.format(item.length()) + " KB");
        sizeColumn.setComparator(new Comparator<File>() {
            @Override public int compare(File f1, File f2) {
                long s1 = f1.isDirectory() ? 0 : f1.length();
                long s2 = f2.isDirectory() ? 0 : f2.length();
                long result = s1 - s2;
                if (result < 0) {
                    return -1;
                } else if (result == 0) {
                    return 0;
                } else {
                    return 1;
        // --- modified column
        TreeTableColumn<File, Date> lastModifiedColumn = new TreeTableColumn<File, Date>("Last Modified");
        lastModifiedColumn.setPrefWidth(130);
        lastModifiedColumn.setCellValueFactory(new Callback<TreeTableColumn.CellDataFeatures<File, Date>, ObservableValue<Date>>() {
            @Override public ObservableValue<Date> call(TreeTableColumn.CellDataFeatures<File, Date> p) {
                return new ReadOnlyObjectWrapper<Date>(new Date(p.getValue().getValue().lastModified()));
        lastModifiedColumn.setCellFactory(new Callback<TreeTableColumn<File, Date>, TreeTableCell<File, Date>>() {
            @Override public TreeTableCell<File, Date> call(TreeTableColumn<File, Date> p) {
                return new TreeTableCell<File, Date>() {
                    @Override protected void updateItem(Date item, boolean empty) {
                        super.updateItem(item, empty);
                        if (item == null || empty) {
                            setText(null);
                        } else {
                            setText(DateFormater.format(item));
        this.treeTblFolderStructure.getColumns().setAll(nameColumn, sizeColumn, lastModifiedColumn);
    private TreeItem<File> createNode(final File f) {
        final TreeItem<File> node = new TreeItem<File>(f) {
            private boolean isLeaf;
            private boolean isFirstTimeChildren = true;
            private boolean isFirstTimeLeaf = true;
            @Override public ObservableList<TreeItem<File>> getChildren() {
                if (isFirstTimeChildren) {
                    isFirstTimeChildren = false;
                    super.getChildren().setAll(buildChildren(this));
                return super.getChildren();
            @Override public boolean isLeaf() {
                if (isFirstTimeLeaf) {
                    isFirstTimeLeaf = false;
                    File f = (File) getValue();
                    isLeaf = f.isFile();
                return isLeaf;
        node.setExpanded(true);
        return node;
    private ObservableList<TreeItem<File>> buildChildren(TreeItem<File> TreeItem) {
        File f = (File) TreeItem.getValue();
        if (f != null && f.isDirectory()) {
            File[] files = f.listFiles();
            if (files != null) {
                ObservableList<TreeItem<File>> children = FXCollections.observableArrayList();
                for (File childFile : files) {
                    children.add(createNode(childFile));
                return children;
        return FXCollections.emptyObservableList();
        public static void main(String[] args) {
            launch(args);

  • Catching onExpand and onCollapse events of treetableview

    Hello,
    I am using the bsp extension treeTableView of crm_bsp_library.
    With this control it is possible to expand and collapse nodes.
    In my controller I catch the onCollapse and onExpand events by the following code:
    event = cl_htmlb_manager=>get_event_ex( request ).
    tabview = ?= event.
    case event->event_server_name.
         when 'myExpand' or 'myCollapse'.
    endcase.
    this code is working so far. Now I would like to get to know in which row the myExpand or myCollapse node is fired.
    event->rowselected contains the currently selected row (the one, which is red), but I cannot find any information on which row was expanded or collapsed.
    Does anybody know where to get this information from?
    Thanks for your help!!!
    Andreas

    Please log a SR with the product team to confirm is this approach is recommended or not.
    Thanks,
    Hussein

  • Building OpenJFX on Windows problem

    I build the OpenJFX distribution on Windows according "https://wiki.openjdk.java.net/display/OpenJFX/Building+OpenJFX".
    Something goes wrong in fxpackager. Help will be appreciated to solve the problem.
    :fxpackager:buildJavaFXPackager FAILED
    FAILURE: Build failed with an exception.
    * What went wrong:
    Execution failed for task ':fxpackager:buildJavaFXPackager'.
    > org.gradle.process.internal.ExecException: Process 'command 'c:/Program Files
    (x86)/Microsoft Visual Studio 10.0/VC/BIN/cl.exe'' finished with non-zero exit v
    alue -1073741515
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug
    option to get more log output.
    BUILD FAILED

    I build the OpenJFX distribution on Windows according "https://wiki.openjdk.java.net/display/OpenJFX/Building+OpenJFX".
    Something goes wrong in fxpackager. Help will be appreciated to solve the problem.
    :fxpackager:buildJavaFXPackager FAILED
    FAILURE: Build failed with an exception.
    * What went wrong:
    Execution failed for task ':fxpackager:buildJavaFXPackager'.
    > org.gradle.process.internal.ExecException: Process 'command 'c:/Program Files
    (x86)/Microsoft Visual Studio 10.0/VC/BIN/cl.exe'' finished with non-zero exit v
    alue -1073741515
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug
    option to get more log output.
    BUILD FAILED

  • crm_bsp_library:treeTableView

    Hi guys,
    I want to create a tree embeded in tableview, so I found the certain tag, and the new tag library.
    Then handler class is CL_CRM_BSP_TREETABLEVIEW.
    Has anybody used it before, or know its usage?
    Thanks and Best Regards,
    Marco

    Hi Mario,
    Thank you very much, for your quick response, for your professional answer.
    But when I want to create a very simple tree as what you said. I found that it could not be expanded or collapsed.
    Do I have to implement it manully? Or I made any mistakes?
    CODE:
    <%@page language="abap"%>
    <%@extension name="htmlb" prefix="htmlb"%>
    <%@extension name="crm_bsp_ic" prefix = "crmic"%>
    <%
    data: lt_tree type CRMT_BSP_TREETABLE_NODE_TAB.
    field-symbols: <fs> like line of lt_tree.
    APPEND INITIAL LINE TO lt_tree assigning <fs>.
    <fs>-NODE_KEY           = '1'.
    <fs>-ICON               = 'ICON_CLOSED_FOLDER'.
    <fs>-ICON_EXPANDED      = 'ICON_OPEN_FOLDER'.
    <fs>-IS_EXPANDED        = 'x'.
    APPEND INITIAL LINE TO lt_tree assigning <fs>.
    <fs>-NODE_KEY           = '2'.
    <fs>-PARENT_KEY         = '1'.
    <fs>-ICON               = 'ICON_CLOSED_FOLDER'.
    <fs>-ICON_EXPANDED      = 'ICON_OPEN_FOLDER'.
    <fs>-IS_EXPANDED      = 'x'.
    APPEND INITIAL LINE TO lt_tree assigning <fs>.
    <fs>-NODE_KEY           = '3'.
    <fs>-PARENT_KEY         = '1'.
    <fs>-ICON               = 'ICON_CREATE'.
    <fs>-IS_LEAF            = 'x'.
    APPEND INITIAL LINE TO lt_tree assigning <fs>.
    <fs>-NODE_KEY           = '4'.
    <fs>-PARENT_KEY         = '2'.
    <fs>-ICON               = 'ICON_CREATE'.
    <fs>-IS_LEAF            = 'x'.
    %>
    <htmlb:content design="design2003">
      <htmlb:page title = " xxx">
        <htmlb:form>
         <crmic:tree id        ="crmtree"
                    nodeTable = "<%=lt_tree%>"
                    table     = "//lv_model/lt_data"
                    keyColumn = "ID"
                    nodeTextColumn = "ID"
                  />
        </htmlb:form>
      </htmlb:page>
    </htmlb:content>
    <b>//lv_model/lt_data</b> filled with data like this:
      data: lt_tree type ztreetb.
      FIELD-SYMBOLS: <fs> like LINE OF lt_tree.
      APPEND INITIAL LINE TO lt_tree ASSIGNING  <fs>.
      <fs>-ID = '1'.
      <fs>-NAME = 'ROOT'.
      APPEND INITIAL LINE TO lt_tree ASSIGNING  <fs>.
      <fs>-ID = '2'.
      <fs>-NAME = 'level1 folder'.
      APPEND INITIAL LINE TO lt_tree ASSIGNING  <fs>.
      <fs>-ID = '3'.
      <fs>-NAME = 'level1 file'.
      APPEND INITIAL LINE TO lt_tree ASSIGNING  <fs>.
      <fs>-ID = '4'.
      <fs>-NAME = 'level2 file'.
      lv_model->lt_data = lt_tree.
    Do I miss anything?
    Thanks and Best Regards,
    Marco
    Message was edited by: Marco CHEN

  • Problem with continue in a for loop

    Hi all
    I have a variable of type Node[] which contains nodes like Text,ImageView and SVGPath etc...
    now i want to filter that group which means i want to separate the Text nodes for that i used a for loop as
    var abc:Node[];
    var abcsize=sizeof abc;
    var textarray:Text[]=for(i in abc){
    if(i.toString()=="Text"){
       i as Text;  //casting Node to Text
                     }//if
               else{
                      continue;     //if the node is not of type Text then i am skipping that one
                     }//else
          }//forwhen i am trying to compile this i am getting the compilation error as
    Note: An internal error has occurred in the OpenJFX compiler. Please file a bug at the
    Openjfx-compiler issues home (https://openjfx-compiler.dev.java.net/Issues)
    after checking for duplicates.  Include in your report:
    - the following diagnostics
    - file 1.2.3_b36
    - and if possible, the source file which triggered this problem.
    Thank you.
        else{
    An exception has occurred in the OpenJavafx compiler. Please file a bug at the Openjfx-compiler issues home (https://openjfx-compiler.dev.java.net/Issues) after checking for duplicates. Include the following diagnostic in your report and, if possible, the source code which triggered this problem.  Thank you.
    java.lang.ClassCastException: com.sun.tools.javac.tree.JCTree$JCContinue cannot be cast to com.sun.tools.javac.tree.JCTree$JCExpression
            at com.sun.tools.javafx.comp.JavafxToJava.translateToExpression(JavafxToJava.java:568)
            at com.sun.tools.javafx.comp.JavafxToJava.visitBlockExpression(JavafxToJava.java:2320)
            at com.sun.tools.javafx.tree.JFXBlock.accept(JFXBlock.java:83)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToExpression(JavafxToJava.java:565)
            at com.sun.tools.javafx.comp.JavafxToJava.translateAsValue(JavafxToJava.java:575)
            at com.sun.tools.javafx.comp.JavafxToJava.visitIfExpression(JavafxToJava.java:3595)
            at com.sun.tools.javafx.tree.JFXIfExpression.accept(JFXIfExpression.java:48)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToExpression(JavafxToJava.java:565)
            at com.sun.tools.javafx.comp.JavafxToJava.visitBlockExpression(JavafxToJava.java:2320)
            at com.sun.tools.javafx.tree.JFXBlock.accept(JFXBlock.java:83)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToExpression(JavafxToJava.java:565)
            at com.sun.tools.javafx.comp.JavafxToJava.translateAsValue(JavafxToJava.java:575)
            at com.sun.tools.javafx.comp.JavafxToJava$5.addElement(JavafxToJava.java:3007)
            at com.sun.tools.javafx.comp.JavafxToJava.visitForExpression(JavafxToJava.java:3212)
            at com.sun.tools.javafx.tree.JFXForExpression.accept(JFXForExpression.java:50)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToExpression(JavafxToJava.java:565)
            at com.sun.tools.javafx.comp.JavafxToJava.translateAsValue(JavafxToJava.java:575)
            at com.sun.tools.javafx.comp.JavafxToJava.translateNonBoundInit(JavafxToJava.java:1861)
            at com.sun.tools.javafx.comp.JavafxToJava.translateDefinitionalAssignmentToValueArg(JavafxToJava.java:1876)
            at com.sun.tools.javafx.comp.JavafxToJava.translateDefinitionalAssignmentToSetExpression(JavafxToJava.java:1917)
            at com.sun.tools.javafx.comp.JavafxToJava.visitVarScriptInit(JavafxToJava.java:1976)
            at com.sun.tools.javafx.tree.JFXVarScriptInit.accept(JFXVarScriptInit.java:67)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToStatement(JavafxToJava.java:598)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToStatement(JavafxToJava.java:628)
            at com.sun.tools.javafx.comp.JavafxToJava.visitBlockExpression(JavafxToJava.java:2306)
            at com.sun.tools.javafx.tree.JFXBlock.accept(JFXBlock.java:83)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToStatement(JavafxToJava.java:598)
            at com.sun.tools.javafx.comp.JavafxToJava.access$700(JavafxToJava.java:89)
            at com.sun.tools.javafx.comp.JavafxToJava$FunctionTranslator.makeRunMethodBody(JavafxToJava.java:2164)
            at com.sun.tools.javafx.comp.JavafxToJava$FunctionTranslator.methodBody(JavafxToJava.java:2224)
            at com.sun.tools.javafx.comp.JavafxToJava$FunctionTranslator.doit(JavafxToJava.java:2279)
            at com.sun.tools.javafx.comp.JavafxToJava.visitFunctionDefinition(JavafxToJava.java:2292)
            at com.sun.tools.javafx.tree.JFXFunctionDefinition.accept(JFXFunctionDefinition.java:93)
            at com.sun.tools.javafx.comp.JavafxToJava.translateGeneric(JavafxToJava.java:500)
            at com.sun.tools.javafx.comp.JavafxToJava.translate(JavafxToJava.java:509)
            at com.sun.tools.javafx.comp.JavafxToJava.visitClassDeclaration(JavafxToJava.java:1261)
            at com.sun.tools.javafx.tree.JFXClassDeclaration.accept(JFXClassDeclaration.java:141)
            at com.sun.tools.javafx.comp.JavafxToJava.translateGeneric(JavafxToJava.java:500)
            at com.sun.tools.javafx.comp.JavafxToJava.translate(JavafxToJava.java:521)
            at com.sun.tools.javafx.comp.JavafxToJava.visitScript(JavafxToJava.java:1147)
            at com.sun.tools.javafx.tree.JFXScript.accept(JFXScript.java:89)
            at com.sun.tools.javafx.comp.JavafxToJava.translateGeneric(JavafxToJava.java:500)
            at com.sun.tools.javafx.comp.JavafxToJava.translate(JavafxToJava.java:517)
            at com.sun.tools.javafx.comp.JavafxToJava.toJava(JavafxToJava.java:691)
            at com.sun.tools.javafx.main.JavafxCompiler.jfxToJava(JavafxCompiler.java:728)
            at com.sun.tools.javafx.main.JavafxCompiler.jfxToJava(JavafxCompiler.java:699)
            at com.sun.tools.javafx.main.JavafxCompiler.compile2(JavafxCompiler.java:785)
            at com.sun.tools.javafx.main.JavafxCompiler.compile(JavafxCompiler.java:685)
            at com.sun.tools.javafx.main.Main.compile(Main.java:624)
            at com.sun.tools.javafx.main.Main.compile(Main.java:312)
            at com.sun.tools.javafx.Main.compile(Main.java:84)
            at com.sun.tools.javafx.Main.main(Main.java:69)
    ERROR: javafxc execution failed, exit code: 4
    D:\work\javaFX\javaFX_workspace\Book_fix\nbproject\build-impl.xml:143: exec returned: -1Any one please help

    - This is a real bug in the compiler, obviously. I wonder if I haven't meet it already, or something similar. Maybe you should report it.
    - The problem is that your code is incorrect anyway: the branch with continue doesn't return a value, so cannot be used in the list building. Well, at least that's what I suppose which confuses the compiler. You can try and return null (which will be discarded) instead of using continue.
    - But your code can be much more efficient, compact and perhaps even more readable, using the powerful JavaFX sequence comprehension:
    var seqMixed = [ 1, "one", Text { content: "Ichi" }, Circle {}, 2, "two", Text { content: "Ni" } ];
    println(seqMixed);
    var seqFiltered = seqMixed[ obj | obj instanceof Text ];
    println(seqFiltered);
    seqFiltered = seqMixed[ obj | not (obj instanceof Text) ];
    println(seqFiltered);

  • Using a Circle object which has been created outside a Group

    Hi all!
    I have one trouble:
    I create a Circle object outside a Group object.
    I trying to use th Circle in the Group and I have got compilation error.
    It's my code:
    * testfx.fx
    * Created on 24.03.2009, 21:19:00
    package testfx;
    import javafx.scene.effect.*;
    import javafx.scene.paint.*;
    import javafx.scene.shape.*;
    import javafx.scene.*;
    import javafx.scene.text.*;
    import javafx.scene.control.*;
    import javafx.scene.transform.*;
    import javafx.stage.Stage;
    var MyCircle : Circle = Circle{
        centerX: 200
        centerY: 200
        radius: 15
        fill: Color.BLUE
    function run(){
        Stage {
            title: "Button"
            width:400
            height:400
            scene: Scene{
                fill: Color.BLACK
                content:[
                    Group{
                        content:[
                            Rectangle{
                                x: 125
                                y: 175
                                width: 150
                                height: 50
                                arcHeight: 5
                                arcWidth: 5
                                stroke: Color.GRAY
                                fill: LinearGradient{
                                    startX: 0.0
                                    startY: 0.0
                                    endX: 0.0
                                    endY: 1.0
                                    proportional: true
                                    stops:[
                                        Stop{offset: 0.0 color: Color.WHITE},
                                        Stop{offset: 1.0 color: Color.BLACK}
                            MyCircle                           <------- (SIC!)    
                        effect: Reflection{
                            fraction: 1.0
                            topOffset: 3
                            topOpacity: 0.8
                            bottomOpacity: 0.2
    }My error:
    Note: The following error is an internal error in the OpenJFX compiler (1.1.0).
    Please file a bug at the Openjfx-compiler issues home (https://openjfx-compiler.dev.java.net/Issues) after checking for duplicates. Include the following diagnostic in your report and, if possible, the source code which triggered this problem. Thank you.
    Where is my mistake here?
    I'm sorry for my English, I have not enough knowledge in it at the moment.
    //Best regards!
    //Alexander

    Try this:
    package testfx;
    import javafx.scene.effect.*;
    import javafx.scene.paint.*;
    import javafx.scene.shape.*;
    import javafx.scene.*;
    import javafx.stage.Stage;
    var myCircle : Circle = Circle{
    centerX: 200
    centerY: 200
    radius: 15
    fill: Color.BLUE
    Stage {
    title: "Button"
    width:400
    height:400
    scene: Scene{
    fill: Color.BLACK
    content:[
    Group{
    content:[
    Rectangle{
    x: 125
    y: 175
    width: 150
    height: 50
    arcHeight: 5
    arcWidth: 5
    stroke: Color.GRAY
    fill: LinearGradient{
    startX: 0.0
    startY: 0.0
    endX: 0.0
    endY: 1.0
    proportional: true
    stops:[
    Stop{offset: 0.0 color: Color.WHITE},
    Stop{offset: 1.0 color: Color.BLACK}
    myCircle
    effect: Reflection{
    fraction: 1.0
    topOffset: 3
    topOpacity: 0.8
    bottomOpacity: 0.2
    By the way, you could define the Circle inline, like this:
    package testfx;
    import javafx.scene.effect.*;
    import javafx.scene.paint.*;
    import javafx.scene.shape.*;
    import javafx.scene.*;
    import javafx.stage.Stage;
    Stage {
    title: "Button"
    width:400
    height:400
    scene: Scene{
    fill: Color.BLACK
    content:[
    Group{
    content:[
    Rectangle{
    x: 125
    y: 175
    width: 150
    height: 50
    arcHeight: 5
    arcWidth: 5
    stroke: Color.GRAY
    fill: LinearGradient{
    startX: 0.0
    startY: 0.0
    endX: 0.0
    endY: 1.0
    proportional: true
    stops: [
    Stop{
    offset: 0.0
    color: Color.WHITE
    Stop{
    offset: 1.0
    color: Color.BLACK
    Circle{
    centerX: 200
    centerY: 200
    radius: 15
    fill: Color.BLUE
    effect: Reflection{
    fraction: 1.0
    topOffset: 3
    topOpacity: 0.8
    bottomOpacity: 0.2
    Thanks,
    Jim Weaver
    JavaFXpert.com (Learn JavaFX blog)
    Edited by: JimWeaver on Mar 25, 2009 1:15 PM
    Edited by: JimWeaver on Mar 25, 2009 1:17 PM

  • CSS Error in running javafx application after move to use jdk8

    Hi all,
    I'm running an javafx app fine with build: jdk-8-ea-b36e-linux-arm-hflt-29_nov_2012 which uses jdk7 perfectly fine on the raspberry pi (which i also keep as backup until newer builds well, are starting to work with my app).
    I'm getting an exception related to CSS (seems to me) when i try to run my javafx app (as well through netbeans on windows xp as through command line on the raspberry pi):
    I've try'd two netbeans versions, the stable 7.3 with jdk 1.8 build 100 and nightly 7.4 with the same jdk 1.8 build. Building goes fine on both these versions.
    The exception is:
    Exception in thread "JavaFX Application Thread"
       java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
       at java.util.ArrayList.rangeCheck(ArrayList.java:638)
       at java.util.ArrayList.get(ArrayList.java:414)
       at com.sun.javafx.css.StyleMap.getCascadingStyles(StyleMap.java:121)
       at javafx.scene.CssStyleHelper.getStyle(CssStyleHelper.java:683)
       at javafx.scene.CssStyleHelper.lookupFont(CssStyleHelper.java:1548)
       at javafx.scene.CssStyleHelper.transitionToState(CssStyleHelper.java:460)
       at javafx.scene.Node.impl_processCSS(Node.java:8665)
       at javafx.scene.Parent.impl_processCSS(Parent.java:1192)
       at javafx.scene.Parent.impl_processCSS(Parent.java:1204)
       at javafx.scene.Node.processCSS(Node.java:8575)
       at javafx.scene.Scene.doCSSPass(Scene.java:538)
       at javafx.scene.Scene.preferredSize(Scene.java:1503)
       at javafx.scene.Scene.impl_preferredSize(Scene.java:1570)
       at javafx.stage.Window$9.invalidated(Window.java:733)
       at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:109)
       at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:143)
       at javafx.stage.Window.setShowing(Window.java:799)
       at javafx.stage.Window.show(Window.java:814)
       at javafx.stage.Stage.show(Stage.java:243)
       at pidome.client.PidomeClient$1$1.run(Unknown Source)
       at com.sun.javafx.application.PlatformImpl$5$1.run(PlatformImpl.java:244)
       at com.sun.javafx.application.PlatformImpl$5$1.run(PlatformImpl.java:241)
       at java.security.AccessController.doPrivileged(Native Method)
       at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:241)
       at com.sun.glass.ui.lens.LensApplication$RunnableEvent.dispatch(LensApplication.java:169)
       at com.sun.glass.ui.lens.LensApplication._runLoop(LensApplication.java:756)
       at com.sun.glass.ui.lens.LensApplication.access$700(LensApplication.java:55)
       at com.sun.glass.ui.lens.LensApplication$4.run(LensApplication.java:815)
       at java.lang.Thread.run(Thread.java:724)
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
       at java.util.ArrayList.rangeCheck(ArrayList.java:638)
       at java.util.ArrayList.get(ArrayList.java:414)
       at com.sun.javafx.css.StyleMap.getCascadingStyles(StyleMap.java:121)
       at javafx.scene.CssStyleHelper.getStyle(CssStyleHelper.java:683)
       at javafx.scene.CssStyleHelper.lookupFont(CssStyleHelper.java:1548)
       at javafx.scene.CssStyleHelper.transitionToState(CssStyleHelper.java:460)
       at javafx.scene.Node.impl_processCSS(Node.java:8665)
       at javafx.scene.Parent.impl_processCSS(Parent.java:1192)
       at javafx.scene.Parent.impl_processCSS(Parent.java:1204)
       at javafx.scene.Node.processCSS(Node.java:8575)
       at javafx.scene.Node.processCSS(Node.java:8566)
       at javafx.scene.Scene.doCSSPass(Scene.java:538)
       at javafx.scene.Scene.access$3600(Scene.java:189)
       at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2294)
       at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:325)
       at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:533)
       at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:513)
       at com.sun.javafx.tk.quantum.QuantumToolkit$16.run(QuantumToolkit.java:380)
       at com.sun.glass.ui.lens.LensApplication$RunnableEvent.dispatch(LensApplication.java:169)
       at com.sun.glass.ui.lens.LensApplication._runLoop(LensApplication.java:756)
       at com.sun.glass.ui.lens.LensApplication.access$700(LensApplication.java:55)
       at com.sun.glass.ui.lens.LensApplication$4.run(LensApplication.java:815)
       at java.lang.Thread.run(Thread.java:724)
    On line 22 is where i think my problem really begins. This line correspondents to my code on line 14:
        @Override
        public void start(Stage primaryStage) {
            redirectOutputToLog();
            rootStage = primaryStage;
            rootStage.setTitle("PiDome Client");
            rootStage.setFullScreen(true);
            rootStage.initStyle(StageStyle.UNDECORATED);
            ready.addListener(new ChangeListener<Boolean>(){
                @Override
                public void changed(
                    ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) {
                        if (Boolean.TRUE.equals(t1)) {
                            rootStage.setScene(mainStage.scene());
                            rootStage.show();
            initialize();
    The rest of my main file is as follows (snippet):
    public class PidomeClient extends Application implements NetworkingEventListener,ClientDataConnectionListener,DomoticsEventListener,MainSceneEventListener,PreloaderCredentials {
    MainScene mainStage;
    BooleanProperty ready = new SimpleBooleanProperty(false);
      public void start(Stage primaryStage){
      /* See above snippet */
        public final void initialize(){
            /* code */
            mainStage = new MainScene();
            /* code */
      /* some functions for the listeners added */
        @Override
        public void handleMainSceneEvent(MainSceneEvent event) {
            if(event.getEventType().equals(MainSceneEvent.SCENEBUILDDONE)){
                notifyPreloader(new StateChangeNotification(StateChangeNotification.Type.BEFORE_START));
                ready.setValue(Boolean.TRUE);
    Some code from my MainScene class:
    public final class MainScene {
        Pane root = new Pane();
        Scene appScene = new Scene(root, DisplayConfig.getScreenWidth(), DisplayConfig.getScreenHeight());
        String theme = Theme.getCurrent();
        NotificationBar notBar = new NotificationBar();
        TopBar topBar          = new TopBar();
        MainControl mainControl= new MainControl();
        BottomBar bottomBar    = new BottomBar();
        //Console   console      = new Console();
        SubControl subControl     = new SubControl();  
      public MainScene(){
        public final void createScene(){
            LOG.debug("Screen dimensions: width: {}, height: {}",DisplayConfig.getScreenWidth(), DisplayConfig.getScreenHeight());
            root.getStylesheets().add(theme + "main.css");
            root.getChildren().add(notBar);
            root.getChildren().add(topBar);
            root.getChildren().add(mainControl);
            root.getChildren().add(bottomBar);
            root.getChildren().add(subControl);
            //console.show();
            _fireSceneBuildDone();
        public final Scene scene(){
            return appScene;
        public final void stop(){
            //topBar.stopThreads();
        public synchronized static void addDoneListener(MainSceneEventListener l){
            _listeners.add(l);
        final synchronized void _fireSceneBuildDone(){
            LOG.debug("New event: {}", MainSceneEvent.SCENEBUILDDONE);
            MainSceneEvent serviceEvent = new MainSceneEvent(this, MainSceneEvent.SCENEBUILDDONE);
            Iterator listeners = _listeners.iterator();
            while (listeners.hasNext()) {
                ((MainSceneEventListener) listeners.next()).handleMainSceneEvent(serviceEvent);
    Further explanation:
    The lines 8 until 14 are the children that have they're own CSS files which are included, they do not contain the .root element. This element is only present in the main.css class. As you can see i'm using a preloader which also has it's own CSS but with the .root element, but this one does not contain anything related to fonts. I have try'd a lot of things because i'm thinking i'm in error because i have seen this on the javafx 8 Performance ideas page (https://wiki.openjdk.java.net/display/OpenJFX/Performance+Ideas): "Rather than running CSS at start up, precompute the defaults and initialize FX to have these values.  This should improve start up time." I do not know if this is related. What i've tryed is
    - move the children created in MainScene to another location,
    - Completely discard the preloader (as wel as in netbeans is in the code),
    - Removed everything that was font related out of my css,
    - Removed everything that was font related from my code,
    - Removed the traling slash to the path to the css returned by my function theme.getCurrent(); But then i get the error that the file is not found.
    - Went completely procedural when creating the scene objects and children.
    I posted a recent amount of  code, and, i'm out of options at the moment. So, is there a bug or am i doing something wrong and should i rethink on how CSS is handled in FX 8?
    Best regards,
    John
    Some changes in explanation.
    Message was edited by: JohnMefster

    Well, i found the/a solution for the above:
    I've put all my css in one file, and found some empty declarations like #mainbottomcontainer .content .label { }. I removed these 3 empty declarations and now my app also works in build 101. So i do now think this has to do with the CSS remark posted above. And i do think this is due to setting CSS in the declaration part of a class at startup (like in my MainScene class above), but i'm not sure. But, it is fixed for now.
    John.

  • Getting bug error while compiling object binding code in javaFX

    I am new to javaFX and exploring it from just last two days.
    today i tried a simple binding object example and got weird exception about bug.
    i created a simple file with name Calculator.fx having just one line public var result=1;and used object binding in another file Customer.fx with following code
    var myStreet=21;
    var address= bind Calculator{
         result:myStreet;
    println({address.result});i got following output error
    init:
    deps-jar:
    Note: An internal error has occurred in the OpenJFX compiler. Please file a bug at the
    Openjfx-compiler issues home (https://openjfx-compiler.dev.java.net/Issues)
    after checking for duplicates.  Include in your report:
    - the following diagnostics
    - file C:\Users\omnidoc\AppData\Local\Temp\javafx_err_59993.txt
    - and if possible, the source file which triggered this problem.
    Thank you.
    C:\cc_storage\Caculator\src\Customer.fx:3: cannot find symbol
    symbol  : variable VOFF$result
    location: class Calculator
    def address= bind Calculator{
    1 error
    ERROR: javafxc execution failed, exit code: 1
    C:\cc_storage\Caculator\nbproject\build-impl.xml:143: exec returned: -1
    BUILD FAILED (total time: 2 seconds)Am i doing something wrong or is it really a bug.
    Also can anyone tell me how to do object binding in javaFX.
    thanks
    chauhan

    chauhan2003 wrote:
    Am i doing something wrong or is it really a bug.When you get such error, that's both: you made a mistake (and at least you get a generally helpful message about it) but the compiler is bugging out and crashing...

  • Does the lack of Open GL support in Java FX 2 force us to use Swing?

    Hi,
    We are about to start the development of a major User Interface in Java. Naturally, we would prefer to implement this in Java FX 2, rather than Swing. However, we need to render heavy 3D models (generated from several CAD files) with overlay from 3D point clouds with ~400K points. We already have a Swing implementation that supports this, based on the JOGL API. What I have understood, there are no support for JOGL or similar OpenGL wrapper in Java FX 2. Instead, Java FX 2 seems to aim at a high level 3D API. Based on previous attempts to use similar high level API's in the .NET world (e.g. WPF 3D), high level 3D API's are usually not appropriate when working with large and complex 3D models.
    Therefore, I would like to ask for suggestions on what to do here. Do we have to develop our new User Interface in Swing because of this? Or can the announced JavaFX SwingNode be used to wrap such a complex Swing component? If so, how would the performance suffer from the JavaFX wrapping? If the SwingNode doesn't solve the issue and we therefore need to implement the main application in Swing, should we still consider implementing non-3D sub-views with Java FX 2 or should we go for Swing all the way? Our developer group has previous experience from Swing, but none from Java FX. Still, it does not feel right to start the development of a new UI - which we intend to maintain for many years from now - using a deprecated application framework. We are about to decide our way forward here and would really appreciate any thoughts on this topic.
    Thanks,
    Thomas Berglund

    See this StackOverflow question: How to use OpenGL in JavaFX?
    It sounds like the best answer for you is the addition of an OpenGL node to JavaFX.
    An OpenGL node has not yet been added to the JavaFX platform.
    As you have a team of people experienced in 3D development and Java and all of the relevant JavaFX code is open source, I'd encourage you to consider creating an OpenGL node or working with Oracle to create one and (if you are inclined) contributing the development back to the JavaFX code base.  If you are interested in this, contact the openjfx-dev mailing list.
    > Do we have to develop our new User Interface in Swing because of this?
    I don't think so.
    > Or can the announced JavaFX SwingNode be used to wrap such a complex Swing component?
    I don't know, but it doesn't sound quite the right approach to me.
    It seems a dedicated OpenGL rendering node would be a better fit as long as you don't need other Swing functions in your SwingNode.
    > If so, how would the performance suffer from the JavaFX wrapping?
    I think if you had a JavaFX Node which was a Swing Node which handled OpenGL then performance would likely be worse than a JavaFX Node that handled OpenGL directly.
    > If the SwingNode doesn't solve the issue and we therefore need to implement the main application in Swing, should we still consider implementing non-3D sub-views with Java FX 2 or should we go for Swing all the way?
    Either way would work, but I do not recommend mixing the technologies for your application unless you need to.
    There are some considerations with mixing JavaFX and Swing:
    1. Swing widgets look different from JavaFX widgets (and it's not trivial to make them look the same).
    2. You have to learn two toolkits then mentally switch between them when developing (this is just annoying).
    3. You have to be (very) careful of threading issues as each toolkit has it's own primary thread.
    4. There are some bugs in mixing JavaFX and Swing (search JFXPanel in the issue tracker) that simply wouldn't occur if you weren't mixing libraries (most of these bugs have been addressed but some are outstanding).
    5. The Swing functionality isn't going evolve, it's good at what it does, but it is not going to change and get better.
    There is (very experimental) work in merging the JavaFX and Swing application threads, which makes a combined programming model a bit nicer to deal with, but it remains to be seen if that experimental feature becomes a default for both platforms.
    Unless you want to reuse existing extensive Swing libraries (like NetBeans RCP), a pure JavaFX application seems preferred (as long as the OpenGL node can be worked out).
    > Our developer group has previous experience from Swing, but none from Java FX.
    There are similarities, previous knowledge of Swing is a benefit, but there are a lot new things to learn in JavaFX (and a few things to unlearn from Swing likely).
    My 2c . . . best of luck with your project.

  • If I Use JavaFX to Create a Game Do I Have to Release the Source Code?

    Hello,
    I've asked this question before, but I just thought I would try it again now
    that version 1.0 is out.
    If I Use JavaFX to Create a Game Do I Have to Release the Source Code?
    Thanx in advance.

    Could you please point me to a resource describing "the JavaFX Runtime license"? I'm trying to find answers to the following questions:
    1. I'd like to use Scenario.jar from the JavaFX project in a desktop app that is not using Webstart and is not an applet. Will I be able to ship the jar with my software?
    2. Can JavaFX applications be distributed as commercial software in the absence of a Web connection?
    What's not clear to me is which is the real license for Scenario.jar (as shipped with JavaFX). Is it the one in openjfx-compiler's trunk, or the one that comes with the JavaFX SDK (which is very vague about redistribution)?

  • Use different "fx-border-image-source" for first tab and remaining tabs

    Hi,
    I'm using something like this
    .tab {
    -fx-padding: 0px 5px -2px 5px;
    -fx-background-insets: 0 -20 0 0;
    -fx-background-color: transparent;
    -fx-text-fill: #c4d8de;
    -fx-border-image-source: url("images/tab5.png");
    -fx-border-image-slice: 20 20 20 20 fill;
    -fx-border-image-width: 20 20 20 20;
    -fx-border-image-repeat: stretch;
    -fx-font-size: 22px;
    .tab:selected {
    -fx-border-image-source: url("images/tab-selected5.png");
    -fx-text-fill: #333333;
         -fx-background-color: red;*/
    to customize the tab appearance of a TabPane.
    That worked well. But I need to use a different set of images for just the first tab. Does anyone know a way to accomplish that?
    Thanks.

    How can I "fix up" the first tab of tab panes that are created after I "fixed up" the first tab of the initial tab pane?
    My app allows user to create new tab panes at any moment during program execution.Not easy to answer this one.
    The best answer would be to use structural pseudoclasses, but (as David points out), they are not yet implemented.
    The trick here is how to identify the first tab of each tab pane so that it can be styled separately from the other panes.
    Doing the styling without a dynamic lookup is preferrable to using a dynamic lookup (i.e. when the first tab is created give it a specific style, e.g. tab0).
    This is how the charts work, where they set style classes based on series of data, e.g. series0, series1 - this allows you to independently style each series of data.
    However the chart stuff has all of that built into the implementation, whereas the tabs don't. To achieve that you would likely need to go into the TabSkin code (http://openjdk.java.net/projects/openjfx/) find out where and how it generates the Tab nodes and write a custom tab skin or extension of the existing one which assigns a numeric style class to each new tab in a pane (e.g tab0, tab1, etc). In other words, not particularly easy if you are unfamilar with the tab skin implementation. You could log a javafx jira feature request to have those style classes set on tabs - file it here => http://javafx-jira.kenai.com.
    In the meantime a simple alternative is to use the dynamic lookup method in my previous post and a hack such that whenever you add a new tab pane to the scene you do something like the following:
    new Timeline(
      new KeyFrame(
        Duration.millis(50),
        new EventHandler<ActionEvent>() {
          @Override public void handle(ActionEvent arg0) {
            Node tab = newTabPane.lookup(".tab");
            if (tab != null) tab.getStyleClass().add("first-tab");
    ).play();The reason for the Timeline is that I don't really know at what stage the css layout pass is executed. I know that when you initially show the stage and then do a lookup, the css pass seems to have already been done and the lookup will work. But for something that is dynamically added or modified after the scene is displayed - I have no idea when the css layout pass occurs, other than it's some time in the future and not at the time that you add the tabPane to the scene. So, the Timeline introduces a short delay to (hopefully) give the css layout pass time to execute and allow the lookup to work (not return null). Not the best or most efficient solution, but should work for you.

  • "Exception occurred during event dispatching". Help me, Please!

    Hi, All:
    when I runing my program, often catch below exception, I couldn't found where I'm wrong, and Why?
    Could you please, give the below exception and
    my code a quick search, and tell me how I to do it, and Why?
    sincerely
    yoursUrey
    Exception occurred during event dispatching:
    java.lang.NullPointerException
    at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:987)
    at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:917)
    at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:858)
    at javax.swing.plaf.ComponentUI.update(ComponentUI.java:39)
    at javax.swing.JComponent.paintComponent(JComponent.java:395)
    at javax.swing.JComponent.paint(JComponent.java:687)
    at javax.swing.JComponent.paintChildren(JComponent.java:498)
    at javax.swing.JComponent.paint(JComponent.java:696)
    at javax.swing.JViewport.paint(JViewport.java:668)
    at javax.swing.JComponent.paintWithBuffer(JComponent.java:3878)
    at javax.swing.JComponent._paintImmediately(JComponent.java:3821)
    at javax.swing.JComponent.paintImmediately(JComponent.java:3672)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:370)
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(System
    EventQueueUtilities.java:124)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:154)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:337)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
    read.java:131)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:98)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
    Exception occurred during event dispatching:
    java.lang.NullPointerException
    at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:987)
    at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:917)
    at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:858)
    at javax.swing.plaf.ComponentUI.update(ComponentUI.java:39)
    at javax.swing.JComponent.paintComponent(JComponent.java:395)
    at javax.swing.JComponent.paint(JComponent.java:687)
    at javax.swing.JComponent.paintChildren(JComponent.java:498)
    at javax.swing.JComponent.paint(JComponent.java:696)
    at javax.swing.JViewport.paint(JViewport.java:668)
    at javax.swing.JComponent.paintWithBuffer(JComponent.java:3878)
    at javax.swing.JComponent._paintImmediately(JComponent.java:3821)
    at javax.swing.JComponent.paintImmediately(JComponent.java:3672)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:370)
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(System
    EventQueueUtilities.java:124)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:154)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:337)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
    read.java:131)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:98)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
    * the code of sort part *
    class TableMouseAdapter extends MouseAdapter{
    public void mouseClicked(MouseEvent env){
    Cursor headerCursor = tableHeader.getCursor();
    String cursorName = headerCursor.getName();
    Debug.println("Cursor Name : "+cursorName);
    TableColumnModel colModel = treeTable.getColumnModel();
    selectedColumnIndex = colModel.getColumnIndexAtX(env.getX());
    boolean isLeftMouse = SwingUtilities.isLeftMouseButton(env);
    if(isLeftMouse){
    if(cursorName.equalsIgnoreCase("Default Cursor")){
    if(env.getClickCount() == 2){
    // Sort the project of that column.
    model.sort(selectedColumnIndex);
    }else if(cursorName.equalsIgnoreCase("East Resize Cursor")){
    if(env.getClickCount() == 2){
    Debug.println("XLocation : "+env.getX());
    selectedColumnIndex = colModel.getColumnIndexAtX(env.getX()-10);
    Debug.println("Column index : "+selectedColumnIndex);
    if(selectedColumnIndex>0){
    // resize the width of this column.
    Vector columnValues = getColumnValues(selectedColumnIndex);
    int maxColumnWidth = getMaxColumnWidth(columnValues, selectedColumnIndex);
    resetColumnWidth(colModel, selectedColumnIndex, maxColumnWidth);
    //>> ******** the sort of the model in TableMouseAdapter
    public void sort(int columnIndex){
    this.sortColumnIndex = columnIndex;
    (new Thread(new ProjectSort(root))).start();
    //<< ******** the sort of the model in TableMouseAdapter
    //>>********** the sort thread run method ********************************
    public void run(){
    // Get the sorter from the stack, if the stack size is 0
    // then create a new sorter for the tree-table.
    MergeSort sorter = getSizeSorter();
    if( sorter == null )
    return ;
    // Set is Ascending sort or not ,
    if(oldSortColumn == sortColumnIndex){
    if(isSortAscending){
    isSortAscending = false;
    }else isSortAscending = true;
    }else {isSortAscending = false;}
    // if sort the tree table could not disply its originality node.
    // it would be disply its sort node
    isNeedOriginalityNode = false;
    sortNode(sorter, node);
    // when sort is over, then push the sort to the stack,
    // for to used at next time.
    recycleSorter(sorter);
    oldSortColumn = sortColumnIndex;
    // After the sort, you need to update the UI, and send the update
    // event to the EventCenter.
    treeTableView.getTreeTable().updateUI();
    EventCenter.broadcast(treeTableView.getTreeTable(), EventCenter.UPDATE, treeTableView.updateHashData());
    //<<********** the sort thread run method ********************************
    //>>********** the updateUI of the treeTableView.getTreeTable() *************
    public void updateUI() {
    TreePath selecedPath= null;
    if(tree!=null){
    selecedPath = tree.getSelectionPath();
    try{
    if(tree != null) {
    tree.updateUI();
    super.updateUI();
    // Use the tree's default foreground and background colors in the
    // table.
    LookAndFeel.installColorsAndFont(this, "Tree.background",
    "Tree.foreground", "Tree.font");
    if(tree != null && selecedPath!=null) {
    //Set the seleted path after updateUI.
    tree.setSelectionPath(selecedPath);
    }catch(Exception exp){ exp.printStackTrace(); };
    //<<********** the updateUI of the treeTableView.getTreeTable() *************

    Dear, turingcomplete :
    Thanks for your help, I was changed the thread in my code, my problem was moved.
    thank you again
    sincerely
    yours Urey

  • Migrating from 2.1 GA to 2.2 beta

    I just switched from 2.1 GA to 2.2 beta b15.
    There are some issues I encountered. Can you help explain and/or solve them?
    1. Drag & Drop in my TreeView/ListView does not work anymore, throwing this exception:
    java.lang.IllegalArgumentException: DataFormat 'contactEntry' already exists.
    -      at javafx.scene.input.DataFormat.<init>(Unknown Source)
    when I call:
    DataFormat dataFormat = new DataFormat("contactEntry");
    in the onDragDetected method.
    This exception even terminates my whole application (COM Error).
    2. Most of my TextFields, which are bound bidirectional to a SimpleStringProperty throw a NullPointerException when I want to type in the textfield:
    java.lang.NullPointerException
    - com.sun.javafx.scene.control.behavior.TextInputControlBehavior.defaultKeyTyped(Unknown Source)
    -      at com.sun.javafx.scene.control.behavior.TextInputControlBehavior.callAction(Unknown Source)
    -      at com.sun.javafx.scene.control.behavior.BehaviorBase.callActionForEvent(Unknown Source)
    -      at com.sun.javafx.scene.control.behavior.TextInputControlBehavior.callActionForEvent(Unknown Source)
    -      at com.sun.javafx.scene.control.behavior.BehaviorBase$1.handle(Unknown Source)
    -      at com.sun.javafx.scene.control.behavior.BehaviorBase$1.handle(Unknown Source)
    3. I have a ComboBox with Enum.values() as DataSource and a cellFactory, which translates the Enum Value into a readable form. In 2.1 it displays correctly in both the ListView AND the button. In 2.2 the cellfactory only applies to the listview. The button displays the Enum.toString() value.
    I've read there was a change to allow a buttonCellFactory, but I would have expected, that, if the button doesn't have any, that it is the same as the normal cellFactory.
    I'd consider 1 & 2 critical bugs, can somebody help?

    Regarding 3), the behavior your describe (where cell factory no longer is used in the ComboBox button area) - this is the new behavior in 2.2. This change had considerable discussion on the openjfx-dev mailing list - if you aren't a member I highly recommend you consider joining. It's always great to get more feedback and have deeper discussions with other members of the community.
    When I made this change, I also updated the ComboBox JavaDoc to demonstrate one possible way of reinstating the old behavior. I have pasted it below for your reference.
    >
    As the ComboBox internally renders content with a ListView, API exists in the ComboBox class to allow for a custom cell factory to be set. For more information on cell factories, refer to the Cell and ListCell classes. It is important to note that if a cell factory is set on a ComboBox, cells will only be used in the ListView that shows when the ComboBox is clicked. If you also want to customize the rendering of the 'button' area of the ComboBox, you can set a custom ListCell instance in the button cell property. One way of doing this is with the following code (note the use of setButtonCell:
    Callback<ListView<String>, ListCell<String>> cellFactory = ...;
    ComboBox comboBox = new ComboBox();
    comboBox.setItems(items);
    comboBox.setButtonCell(cellFactory.call(null));
    comboBox.setCellFactory(cellFactory);
    >
    -- Jonathan

  • Drag and drop to Windows desktop

    Hi
    I've been struggling with this for a while, I've got a TransferHandler class that allows drag and drop from Windows desktop to application, now I'd like to do the reverse, but can't seem to provide the suitable DataFlavor to the OS, I'm using javaFileListFlavor obviously. I am currently creating a Transferable with createTransferable, but this is a StringSelection, and I can't remove this because I need it for internal drag and drop in the application. Please advise.
    public class CDrag extends TransferHandler {
        public CDrag(TreeTableView ttv) {
            this.ttv = ttv;
            dndData = new ArrayList();
            relPath = "/";
            try {
                uriFlavor = new DataFlavor("text/uri-list;class=java.lang.String");
            } catch (ClassNotFoundException e) {
        @Override
        public int getSourceActions(JComponent c) {
            return MOVE;
        @Override
        protected Transferable createTransferable(JComponent c) {
            String nodes = "";
            int j = 0;
            TreePath[] sel = ttv.treeTable.getTreeSelectionModel().getSelectionPaths();
            for (TreePath i : sel) {
                FileNode fNode = (FileNode) i.getLastPathComponent();
                if (j > 0) {
                    nodes = nodes + "\n";
                nodes = nodes + fNode.toString();
                j++;
            return new StringSelection(nodes);
        @Override
        protected void exportDone(JComponent c, Transferable t, int action) {
            if (!dndData.isEmpty()) {
                File[] sg = (File[]) dndData.toArray();
             // delete files that are dropped
                dndData.clear();
        @Override
        public boolean canImport(TransferSupport supp) {
            if (supp.isDataFlavorSupported(DataFlavor.stringFlavor)) {
                return true;
            if (supp.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
                return true;
            if (supp.isDataFlavorSupported(uriFlavor)) {
                return true;
            return false;
        private boolean importFiles(TransferSupport supp, File[] files) {
         // function that recursively processes all files and folders
        @Override
        public boolean importData(TransferSupport supp) {
            if (!canImport(supp)) {
                return false;
            String fns = "";
            Transferable t = supp.getTransferable();
            try {
                if (supp.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
                    File[] fnsl = (File[]) ((List) t.getTransferData(DataFlavor.javaFileListFlavor)).toArray();
                    return importFiles(supp, fnsl);
                } else if (supp.isDataFlavorSupported(uriFlavor)) {
                    String s = (String)t.getTransferData(uriFlavor);
              StringTokenizer st = new StringTokenizer(s, System.getProperty("line.separator"));
              ArrayList files = new ArrayList<File>();
              while (st.hasMoreTokens()) {
                   String file = st.nextToken();
                   try {
                           URL url = new URL(file);
                        files.add(new File(URLDecoder.decode(url.getPath())));
                   } catch (MalformedURLException mue) {
                    return importFiles(supp, (File []) files.toArray());
                } else {
                    fns = (String) t.getTransferData(DataFlavor.stringFlavor);
            } catch (UnsupportedFlavorException ex) {
                Logger.getLogger(CDrag.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(CDrag.class.getName()).log(Level.SEVERE, null, ex);
         // the rest of the code here process a StringSelection
            return true;
        private List<File> dndData;
        private String relPath;
        private DataFlavor uriFlavor;
    }I have the following information available in the FileNode class - the name of the file, the path inside the application, date modified, size, whether it is a file or folder. How do I get these values into a javaFileListFlavor that Windows will understand? Also, I would need a way of returning the actual file data (which will be read from a remote server). The basic File class doesn't allow many of these things to be set.
    Regards
    Lionel

    I have the following information available in the FileNode class - the name of the file, the path inside the application, date modified, size, whether it is a file or folder. How do I get these values into a javaFileListFlavor that Windows will understand? Also, I would need a way of returning the actual file data (which will be read from a remote server). The basic File class doesn't allow many of these things to be set.I know I tried the same thing - I'm not sure this can be done at all, it could be that this can't be done if the file doesn't already exist somewhere on the local file system.
    Edited by: tjacobs01 on Feb 11, 2009 12:41 AM

Maybe you are looking for

  • Going from a G4 12" powerbook to a new iMac

    hi there, we bought a new iMac for family use a few months ago. we did not have a firewire cable when we first started it so i was not able to migrate all of the stuff on my 12" G4 powerbook to the new computer. for a while i thought i just wanted to

  • Dreamweaver Namespace issue on my web server

    I am hosting my site on GoDaddy.com. I have created a site using Dreamweaver CS3 and SQL2005. Everything works great on my local machine, but when I upload it to the remote web server, the aspx pages do not work. GoDaddy support says it is due to the

  • How do I output three digital waveforms at once?

    I posted this in Digital I/O, but now I think it's actually more appropriate here because it's not a hardware question. I need to output three digital waveforms at a relatively low frequency, 71.9 Hz. I have a PCI DAQ card, the 6024E and am using the

  • Error when trying to  download from OpenLibrary

    Every time I try to download a book from OpenLibrary or any other site with a similar setup I get a "Page not found' or equivalent error. It's as if a port or program is blocked by a firewall but I've made all the exceptions and even tried turning th

  • Photoshop CS5 scanner problem

    I am using photoshop CS5 (PC version) and windows XP SP3, I install a driver for my Plustek scanner but the CS5 could not detech there is a scanner inspite of re-install. But when using the Adobe Acrobat 9 it could detech the scanner and so I am usin