Diffrent coordinates between Scene builder and javafx

Hello,
I'm building an image using javafx, i don't want to use fxml, but i tried to use scene builder to help me identify my object corrdinates.
I have to add a background picture and to add some other graphic object, when using exactly same coordinates for my background picture and graphic object (got from generated fxml) i did not find the same corrdinates?
Is there any clear reason.
Help :)

Thank you jrguenther! yes, I the input images with File>Import>Media menu
But, how I program a piece (image png) to move with the mouse click on the board?
My project is a game.
Please!

Similar Messages

  • Binding issue between POJO properties and JavaFX components

    Currently, what I want to do is use bidirectionnal binding between POJO properties and JavaFX components.
    For example, if the property is a String, a Textfield will be generated and binded with it.
    My POJOs are generated by JAXB.
    To do that, I proceeded as followed :
    In order to make the binding works I changed the default generation of JAXB
    I created a factory which takes a class instance at input and return a Map containing the POJO properties as key and the JavaFX components as value
    I displayed this map in a JFXPanel
    Here is a sample of the factory  :
    public static Map<Field, Node> createComponents(Object obj) throws NoSuchMethodException
               Map<Field, Node> map = new LinkedHashMap<Field, Node>();
               for (final Field field : obj.getClass().getDeclaredFields())
                   @SuppressWarnings("rawtypes")
                   Class fieldType = field.getType();
                   if (fieldType.equals(boolean.class) || (fieldType.equals(Boolean.class))) //Boolean
                       map.put(field, createBool(obj, field));
                   else if (fieldType.equals(int.class) || (fieldType.equals(Integer.class))) //Integer
                      map.put(field, createInt(obj, field));
                   else if (fieldType.equals(BigInteger.class)) //BigInteger
                      map.put(field, createBigInt(obj, field));
                   else if (fieldType.equals(long.class) || fieldType.equals(Long.class)) //Long
                      map.put(field, createLong(obj, field));
                   else if (fieldType.equals(String.class)) //String
                      map.put(field, createString(obj, field));
               return map;  
    public static Node createBool(Object obj, final Field field) throws NoSuchMethodException
       System.out.println(field.getType().getSimpleName() + " spotted");
       JavaBeanBooleanProperty boolProperty = JavaBeanBooleanPropertyBuilder.create().bean(obj).name(field.getName()).build();
      boolProperty.addListener(new ChangeListener<Boolean>() {
       @Override
       public void changed(ObservableValue<? extends Boolean> arg0, Boolean arg1, Boolean arg2)
      prettyPrinter(field, arg1, arg2);
       CheckBox cb = new CheckBox();
      cb.setText(" : " + field.getName());
      cb.selectedProperty().bindBidirectional(boolProperty);
       return cb;}
    So, the problem I have is : Sometimes the binding will work and sometimes it won't. For example, the binding is working unless I changed the declaration property order in the POJO, or unless I resized the panel where components are displayed.
    Does anybody have an idea of what I am doing wrong ?
    Thanks,
    Bastien

    You may like to look at the PropertySheet from ControlsFX.
    Not sure if it does what you want, but the concept appears similar.

  • Difference between Java applet and JavaFX

    Hello, all!
    I am studying javaFX in general. As far as I understand there is no main difference between java applet and javafx, except javafx has different syntax and library simple to use. Is it right?

    Basically, yes. But as you point out, it is supposed to be faster to develop in JavaFX...
    For example, Processing allows to export to applet, and is strong on doing graphics, but to see if user has clicked on a circle, you have to check the mouse coordinates against the circle coordinates, or create your own Circle class: it is at a much lower level.
    Likewise, you can use gaming frameworks like Slick2D or PulpCore, but they might be lacking on GUI (but perhaps faster). Or use Apache's Pivot, strong on GUI, but perhaps lacking a bit on graphics and animation.
    It depends on your needs, if you prefer to stick to Java, etc.

  • Scene Builder and NetBeans

    2 Questions:
    1) When I create a NetBeans project that I want to combine with a Scene Builder fxml file, what project type do I need to create (i.e., JavaFX or FXML)? Regardless of the project type I select, I don't see the same structure as when I load the sample projects.
    2) I, perhaps incorrectly, assumed that the purpose of binding the fxml file to the Java controller class was so that a shell of controller methods would would be created automatically. I have not seen that happen. Is my assumptions incorrect>
    Thanks,
    Jerry

    Hi,
    The following works for me - although it is a bit hacky: remove the text of the tab, and instead put the text as a rotated graphic. Then set the tab max height property of the tab pane to allow the tab thumb to grow.
    To make it work I also had to wrap the rotated text in a Group itself wrapped inside a StackPane, and then I had to set the pref height of that stack pane explicitly.
    Here is my FXML - create with SceneBuilder:
    <?xml version="1.0" encoding="UTF-8"?>
    <?import java.lang.*?>
    <?import java.util.*?>
    <?import javafx.scene.*?>
    <?import javafx.scene.control.*?>
    <?import javafx.scene.layout.*?>
    <?import javafx.scene.paint.*?>
    <AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml">
      <children>
        <TabPane id="tabPane1" layoutX="99.0" layoutY="90.0" prefHeight="200.0" rotateGraphic="true" side="LEFT" tabClosingPolicy="UNAVAILABLE" tabMaxHeight="2000.0">
          <tabs>
            <Tab id="tab1" text="">
              <content>
                <AnchorPane id="Content" minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
              </content>
              <graphic>
                <StackPane id="StackPane" minHeight="-Infinity" minWidth="-Infinity" prefHeight="160.0">
                  <children>
                    <Group id="Group">
                      <children>
                        <Label id="label1" rotate="90.0" text="This is a long tab name" />
                      </children>
                    </Group>
                  </children>
                </StackPane>
              </graphic>
            </Tab>
            <Tab id="tab2" text="">
              <content>
                <AnchorPane id="Content" minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
              </content>
              <graphic>
                <StackPane id="StackPane" minHeight="-Infinity" minWidth="-Infinity" prefHeight="160.0">
                  <children>
                    <Group id="Group">
                      <children>
                        <Label id="label1" rotate="90.0" text="This is a long tab name" />
                      </children>
                    </Group>
                  </children>
                </StackPane>
              </graphic>
            </Tab>
          </tabs>
        </TabPane>
      </children>
    </AnchorPane>Maybe there exist more elegant ways to do this using CSS...
    Hope this helps,
    --daniel                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Scene builder and nodes position

    Hi,
    I've created form using scene builder, additionaly from java code I want to draw some shapes on this form and I need positions of nodes.
    How can I check that? Also I need to be informed when user resizes the window to compute new positions of nodes.
    Thanks for your help.
    Lukasz

    On the Scene or Stage you can add listeners to the height and width properties.
    scene.heightProperty().addListener(windowResized);
    scene.widthProperty().addListener(windowResized);
        private static ChangeListener windowResized = new ChangeListener() {
            @Override
            public void changed(ObservableValue arg0, Object arg1, Object arg2) {
                //code to handle window resizing
        };thanks
    jose

  • Allignment problem between Report Builder And Apps

    Hi All :
    If i am running a report in report builder i am getting 20 records in each page of the reports.but when i am running this same report in apps i am getting 24 records in each page of the apps more than this the records allignment everything has been changed in apps even i am setting equal page setup to both apps and report builder and style and rows and columns also having commen setup. so any one can help how to get same output in both apps and report builder for each and every page(20 records and 20 records)...

    Hi ,
    I have check the /etc/hosts & /etc/services file.
    Both are ok.
    can ping hostname & ip. Can resolve hostname and ip at DNS.
    port 3217 & 3317 is open.
    What else that I should check?
    Thanks.
    ck chai

  • Builiding animations using FXML or the Scene Builder in javaFX

    please i wanna know if its possible building user interfaces with dynamic nodes or animations using FXML or the Scenebuilder in JavaFX
    Elikem.

    HI,
    Currently SceneBuilder is still a baby v.1.x You can only create nodes and make some graphical , layout, stylesheets changes on them. The animation can't be done from the FXML so Scenebuilders dont have these concepts. You will need to have hard code for this. But I still think SceneBuilder is far more Flexible,fast and easy to build javafx application.
    Thanks
    Narayan

  • Round trip between Flash Builder and Catalyst?

    Is it, or will it, be possible to go back to Flash Catalyst once a project as been brought into Flash Builder?
    I have imported the .fxp project into Flash Builder, made some code changes, then exported a .fxp project out again.  I want to be able to edit this in Catalyst so I can make design changes, but when I try to open the project Catalyst says it cannot be opened becuase it has been edited outside of the application.  Is there something I am missing or has this simply not been implemented yet?
    It would be a shame to not be able to "round trip" from Catalyst to Builder.
    Thanks for your time and the product looks very exciting.

    Hi Watern,
    For the first version of Catalyst, we're focusing on the one-way workflow from Catalyst to Builder (start in Catalyst, finish in Builder). We realize this is a big limitation and hope to address soon after the first release.
    There are a number of partial solutions for this problem, which you can find by searching around the forum. Most of them involve dividing the work between Catalyst and Flash Builder as cleanly as possible, which is surprisingly easy to do given the new skinning architecture. Here's an excerpt from a post I wrote that seems to have been lost:
    "If you are iterating between Catalyst and Builder on a custom component, you may find it is worth splitting the custom component out in that fashion. I'm planning to write an article explaining this, but here's a preview:
      In Builder, create a new subclass of SkinnableComponent. Put the component logic in there.
      If you need to add visual logic like "now move the konfabulator 10px to the left", you should make konfabulator a skin part, using the metadata (see Scrollbar.as, in the Flex 4 SDK, for an example).
      If your component has states, declare them with the metadata.
      In Catalyst, make sure that your custom component has those parts and states.
      Then import the custom component into Builder.
      In the MXML file for the custom component, change the root tag <Group> to <Skin>. It's now a skin (not a custom component).
      In the MXML file for the skin, add the [HostComponent("com.me.MyComponent")] metadata (see HScrollbarSkin.mxml, in the Flex 4 SDK, for an example).
      Wherever you are creating the instance, change the code <MyComponent/> to <MySkinnableComponent skinClass="MyComponent"/>. Now you're creating an instance of your skinnable component and assigning it the skin created in Catalyst.
    Done! If you make more changes in Catalyst, you'll have to repeat steps 5-7 again (for now!)."
    -Adam

  • Scene Builder Inspector

    I am using Scene Builder and I would like to replicate the inspector look.
    My questions:
    1) Are Padding, size, position areas ...etc panels within a Scroll Pane or are just two separators with a label in between ? It looks like a Swing TitledBorder Jpanel.
    2) In case of panels, what has been used and how to set a title ?
    3) Is there a naming convention for fx:id field? I have only find some examples all written in lowercase such as "maintabbedpane".
    Thanks

    acepsut wrote:
    I am using Scene Builder and I would like to replicate the inspector look.
    My questions:
    1) Are Padding, size, position areas ...etc panels within a Scroll Pane or are just two separators with a label in between ? It looks like a Swing TitledBorder Jpanel.It's a Label over an HBox which is squeezed by setting its maxHeight to a little value.
    Something close to this:
    <StackPane prefHeight="-1.0" xmlns:fx="http://javafx.com/fxml">
    <children>
    <HBox maxHeight="2.0" prefHeight="-1.0" prefWidth="-1.0" style="-fx-background-color: gray;-fx-background-insets: -1 -17 1 -17, 0 -17 1 -17;" />
    <Label style="-fx-font-weight: bold;-fx-background-color: white;-fx-padding: 0 6 5 6;" text="Title" />
    </children>
    </StackPane>
    >
    2) In case of panels, what has been used and how to set a title ?Will try to find out.
    >
    3) Is there a naming convention for fx:id field? I have only find some examples all written in lowercase such as "maintabbedpane".I am not aware of any.
    fx:id can be considered as java variable name.
    So using camel case seems natural to me.
    Eric

  • Scene Builder: cannot edit when I embed a custom control!

    Hi guys, I'm having an issue with Scene Builder and embedded custom controls...
    I have a LoginPanel .fxml/.java module, which contains two re-usable custom controls I've built:
    * StatusZone .fxml/.java
    * LanguageSelector .fxml/.java
    The application runs.
    However, I can't open LoginPanel.fxml to edit it with SceneBuilder v1.1 (developer preview).
    To be specific, in LoginPanel.fxml, I have this data:
    <StatusZone fx:id="statusZone" />
    <LanguageSelector fx:id="languageSelector" />
    SCENARIO 1
    -- LoginPanel.fxml --
    <?import kalungcasev2.view.StatusZone?>
    <?import kalungcasev2.view.LanguageSelector?>
    I get:
    Warning: File 'LoginPanel.fxml' contains references to types that could not be loaded.
    Missing types are [kalungcasev2.view.StatusZone]
    I can click 'Set up classpath', but no matter which folder I choose, it doesn't seem to fix the problem.
    SCENARIO 2:
    -- LoginPanel.fxml --
    <?import kalungcasev2.view.*?>
    I get:
    Warning: File 'LoginPanel.fxml' contains references to types that could not be loaded.
    Missing types are: [StatusZone, LanguageSelector]
    I can click 'Set up classpath', but no matter which folder I choose, it doesn't seem to fix the problem.
    How do I fix this?

    Hi,
    If no ClassLoader is configured in the FXMLLoader, then the FXMLLoader will try to load the
    classes using the System/Context class loader.
    This works well in the context of an application where everything is in the system class loader.
    In SceneBuilder however - your classes will not be in the System class loader, but in a special
    URL class loader that SceneBuilder created for your FXML file.
    SceneBuilder sets this ClassLoader on the FXMLLoader that loads your top FXML file,
    but it can't do anything for the instances of FXMLLoader that your own code creates.
    Therefore - it's best to configure your FXMLLoader with the appropriate class loader,
    which is usually the class loader that loaded your custom type.
    See https://javafx-jira.kenai.com/browse/DTL-5177 for more details.
    -- daniel
    Edited by: daniel on Apr 25, 2013 7:33 AM
    Sorry - to be more precise:
    loader.setClassLoader(this.getClass().getClassLoader());
    is the correct line.

  • [SOLVED]Scene Builder 2.0 not opening

    When i open the JavaFX Scene Builder 2.0,nothing happens.
    I'm using Windows 7 with JDK 8(64Bit).

    Hi Cyberboy,
    Have you verified the problem recurs if you take it out of the exclusion list again?
    I don't have any problem with BitDefender, Scene Builder and Win7.
    Have you seen this solution:
    http://deltadata.wordpress.com/2013/12/25/javafx-scene-builder-failed-to-create-jvm-fix/ :
    1.Search for regedit.exe and run it.
    2.Go to HKEY_CURRENT_USER\Software\JavaSoft\Prefs\com\oracle\javafx\scenebuilder\/J/V/M/User/Options
    3.Edit the value from 999m to 512m

  • I18n in scene builder

    I'm trying to internationalize a JavaFX 2.2 app.
    When I set the resource file (.properties) in Scene Builder, I can see labels with text in selected language. But when I try to run it, this gives me the following error:
    No resources specified.
    file:/C:/Users/xxx/dist/I18n.jar!/org/osl/javafx/InterfaceScn.fxml:34
    and line 34 in my fxml file is:
    *<Label id="lineNumberValue" layoutX="343.0" layoutY="63.0" text="%lineNumber" />*
    in .properties file lineNumber key is set and as I have already mentioned I can see in scene builder that it takes value from the .properties file.
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    If I remove this .properties resource from within scene builder and set "*-fx-font-family: "Raavi";*" in my stylesheet, it works fine but now I can't see the actual words but boxes in scene builder.
    I mean now the app runs fine and I can read text of labels in that other language but its very difficult to design interface in scene builder.
    Isn't there any way by which I can see values from .properties file while designing the interface and it also let the app to run.
    I have tried putting localizing code in my main class by setting Locale and then using ResourceBundle to load my .properties resource by that didn't work either.
    Thanks, for any suggestion or example code. Cheers.

    but that's my point. " *Preview > Internationalization > Set Resource and select your resource bundle*" set the correct values from my resource file. But on running the app I get the following error.
    I figured out that it is not the declaration of resource file in fxml that is causing this error but the rather it is the line where I set the value like:
    *<Label id="lineNumberValue" layoutX="343.0" layoutY="63.0" text="%lineNumber" />*
    To me it looks like, javafx is unable to find the resource file at run time. But If I remove the *'%***'* thing and then use css for setting font family, It loads the interface without any issue.
    I mean I didn't get any error for loading resource-bundle or anything.
    This is the code that I'm using to load the resource file:
    Locale myLocale = new Locale("pa-IN");
    ResourceBundle rb = ResourceBundle.getBundle("org.osl.javafx.interfaceScn", myLocale );
    But thanks for documentation links. I will look into sample app, if that can give me some hint.
    And here is the complete error:
    run:
    No resources specified.
    file:/C:/Users/xxx/dist/I18n.jar!/org/osl/javafx/InterfaceScn.fxml:33
    at javafx.fxml.FXMLLoader$Element.processPropertyAttribute(FXMLLoader.java:305)
    at javafx.fxml.FXMLLoader$Element.processInstancePropertyAttributes(FXMLLoader.java:197)
    at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:588)
    at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2430)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2136)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2028)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2742)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2721)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2707)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2694)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2683)
    at org.osl.javafx.I18n.start(I18n.java:44)
    at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
    at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:206)
    at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:173)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
    at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
    at java.lang.Thread.run(Thread.java:722)
    Sep 21, 2012 9:19:50 AM org.osl.javafx.I18n start
    SEVERE: null
    javafx.fxml.LoadException: No resources specified.
         at javafx.fxml.FXMLLoader$Element.processPropertyAttribute(FXMLLoader.java:305)
         at javafx.fxml.FXMLLoader$Element.processInstancePropertyAttributes(FXMLLoader.java:197)
         at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:588)
         at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2430)
         at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2136)
         at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2028)
         at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2742)
         at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2721)
         at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2707)
         at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2694)
         at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2683)
         at org.osl.javafx.I18n.start(I18n.java:44)
         at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
         at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:206)
         at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:173)
         at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
         at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
         at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
         at java.lang.Thread.run(Thread.java:722)

  • Scene Builder & Date Picker

    Hi All
    Very quick question. I've just start to get involved in the java world, and have started to look at JavaFX 2 and the Scene Builder. Scene Builder looks very good, but I can't see a Date Picker control at all. I can see lots of examples for using a date picker, but none with with Scene Builder or FXML.
    Is this not possible at the moment?
    Thanks
    Andy Baptie

    In case anyone else comes up against this issue, I've got a bit further with it although it's not perfect.
    I've use jFXtras
    This was all done on a Mac.
    Open up the Scene Builder Package, navigate to Contents\Java and copy jfxtras-labs-0.1.jar in the folder.
    Right Click your .fxml file in Netbeans, and select edit.
    Create an entry for you DatePicker
    eg
    <CalendarTextField prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="0" />
    add the required import
    <?import jfxtras.labs.scene.control.CalendarTextField?>
    After saving, you can open the fxml in Scene Builder and carry on as usual
    Cheers
    Andy

  • Why does Scene Builder constantly create new instances of Nodes?

    Hi,
    I thought I had a simple idea for creating a control that would let me get some of the behavior of a card pane.  This is the entire control:
    import javafx.beans.property.BooleanProperty;
    import javafx.beans.property.SimpleBooleanProperty;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.ObservableValue;
    import javafx.scene.Node;
    import javafx.scene.Parent;
    import javafx.scene.layout.StackPane;
    public class Card extends StackPane {
        private final BooleanProperty active = new SimpleBooleanProperty();
        public final BooleanProperty activeProperty() {return active;}
        public final boolean isActive() {return active.get();}
        public final void setActive(boolean active) {this.active.set(active);}
            visibleProperty().bind(active);
            managedProperty().bind(active);
            active.addListener(new ChangeListener<Boolean>() {
                @Override
                public void changed(ObservableValue<? extends Boolean> observable,
                                    Boolean old,
                                    Boolean active) {
                    System.out.println(toString() + " active changed to: " + active);
                    if(active) {
                        Parent parent = getParent();
                        if(parent != null) {
                            System.out.println("Parent is: " + parent.toString());
                            parent.getChildrenUnmodifiable().forEach(Card.this::deactivateIfCard);
                        else {
                            System.out.println("Parent is null.");
        private void deactivateIfCard(Node node) {
            if(node != this && node instanceof Card) {
                Card card = (Card) node;
                card.setActive(false);
    The idea is pretty simple; extend StackPane, add an active property, bind the visible and managed properties of the pane to the active property, and, whenever the active property is changed to true, iterate sibling nodes de-activating any siblings that are also of the type Card.
    However, this doesn't work with Scene Builder.  While trying to debug, I created an ExtStackPane:
    import javafx.collections.ListChangeListener;
    import javafx.scene.Node;
    import javafx.scene.layout.StackPane;
    public class ExtStackPane extends StackPane {
            getChildren().addListener((ListChangeListener<Node>) c -> {
                System.out.println("ExtStackPane children change: " + c.toString());
    All this does is log list change events.  However, I was very surprised by the output when working in Scene Builder.  I added both controls to Scene Builder and did the following:
    0) Added an ExtStackPane
    1) Added a Card to the ExtStackPane
    2) Added another Card to the ExtStackPane
    3) Added a Label to the first Card
    4) Added a Label to the second Card
    5) Changed the text of the first Label to Hello
    6) Changed the text of the second Label to World
    7) Set the first Card to active
    8) Set the second Card to active
    I get the following output:
    1)
    ExtStackPane children change: { [Card@5b9067b3] added at 0 }
    2)
    ExtStackPane children change: { [Card@6b6328bd] added at 0 }
    ExtStackPane children change: { [Card@6aca8cc5] added at 1 }
    3)
    ExtStackPane children change: { [Card@3b7bc340] added at 0 }
    ExtStackPane children change: { [Card@1879819e] added at 1 }
    4)
    ExtStackPane children change: { [Card@60ffed67] added at 0 }
    ExtStackPane children change: { [Card@64955a14] added at 1 }
    5)
    ExtStackPane children change: { [Card@5dc96bc4] added at 0 }
    ExtStackPane children change: { [Card@40667c26] added at 1 }
    6)
    ExtStackPane children change: { [Card@164770fa] added at 0 }
    ExtStackPane children change: { [Card@7decebbf] added at 1 }
    7)
    Card$1@f4f4850 active changed to: true
    Parent is null.
    ExtStackPane children change: { [Card@27442c8b] added at 0 }
    ExtStackPane children change: { [Card@643d810e] added at 1 }
    8)
    Card$1@4877c67b active changed to: true
    Parent is null.
    ExtStackPane children change: { [Card@7e8a473e] added at 0 }
    Card$1@2b4497c1 active changed to: true
    Parent is null.
    ExtStackPane children change: { [Card@5df6c8cc] added at 1 }
    This is what things look like in Scene Builder:
    Does Scene Builder recreate the entire hierarchy every time I make a small change?  Here's an application that does the same as the manual steps I performed in Scene Builder:
    import javafx.application.Application;
    import javafx.scene.Scene;
    import javafx.scene.control.Label;
    import javafx.stage.Stage;
    public class CardApplication extends Application {
        @Override
        public void start(Stage primaryStage) throws Exception {
            ExtStackPane stackPane = new ExtStackPane();
            // 1
            Card card1 = new Card();
            stackPane.getChildren().add(card1);
            // 2
            Card card2 = new Card();
            stackPane.getChildren().add(card2);
            // 3
            Label label1 = new Label();
            card1.getChildren().add(label1);
            // 4
            Label label2 = new Label();
            card2.getChildren().add(label2);
            // 5
            label1.setText("Hello");
            // 6
            label2.setText("World");
            primaryStage.setScene(new Scene(stackPane));
            primaryStage.setTitle("Card Application");
            primaryStage.setWidth(600);
            primaryStage.setHeight(400);
            primaryStage.show();
            // 7
            card1.setActive(true);
            // 8
            card2.setActive(true);
    The output when running the above is:
    1)
    ExtStackPane children change: { [Card@6dfaa767] added at 0 }
    2)
    ExtStackPane children change: { [Card@6aa2c411] added at 1 }
    7)
    Card$1@1abf7511 active changed to: true
    Parent is: ExtStackPane@41993867[styleClass=root]
    8)
    Card$1@5733cd2 active changed to: true
    Parent is: ExtStackPane@41993867[styleClass=root]
    Card$1@1abf7511 active changed to: false
    The behavior is obviously a lot different than when I'm working with the control in Scene Builder.  Can anyone explain to me what Scene Builder is doing to change the behavior of my Card control so much?  Does my Card control break some rule(s) I'm not aware of?

    I think you're confused about what SceneBuilder is doing.
    SceneBuilder is a design tool, used by the programmer (not the end user) to generate part of the code that is used to execute the application. (Specifically, it generates the FXML code that is parsed by the FXMLLoader to create and configure objects that are typically part of the scene graph.)
    While you are using SceneBuilder to create the code, it generates a mock-up of what the UI will look like, if the generated FXML were to be loaded and displayed. This mock-up is not supposed to be an identical view of what the end user will see, but an aid to you, as the programmer, to generate the code you want.
    So, for your Accordion/TitledPane example, in the mock-up that SceneBuilder displays, the *selected* titled pane is always displayed expanded. This enables you to drag and drop items into it, and to configure it in other ways. If you uncheck the "expanded" checkbox in the properties pane, then it remains expanded in the mock-up so that you can continue to configure it. However, this property is not ignored: the state of those checkboxes is respected in the FXML file that is generated. So when you hit "save" in SceneBuilder, the generated fxml will contain TitledPane element with expanded="true" if the check box is checked, and expanded="false" if the check box is unchecked. (SceneBuilder will of course also enforce the rule that only one TitledPane in an Accordion can be expanded.)
    Similarly, for your custom control, you should be able to set it up so SceneBuilder displays the "active" property in the check box. If you uncheck that property, so active=false, that will be respected in the fxml and when you execute the application, active will be set to false, and so by your binding, visible will be set to false and the component won't display. But the mock-up in SceneBuilder will (of course) still display your component, because it would be extremely difficult for you to configure a component that didn't appear in the programming tool.
    In fact, there's no real reason for SceneBuilder to create any objects that you are configuring at all. It could just try to figure out what they look like and render a depiction of them on a canvas, for example. That's probably much (much) more difficult than instantiating them and the authors of SceneBuilder apparently chose to write SceneBuilder in a way that re-instantiated the controls many times. But that has absolutely nothing to do with what happens when you execute the application and it makes no sense at all to compare the two.

  • Scene Builder 1.0 will not start

    Hi. For a number of months I've been using Scene Builder 1.0 (BuildInformation = Version: 1.0-b50, Changeset: 22db15834430 Date = 2012-08-07 16:33) on a Windows 7 system. However, it has been about a month since I last used Scene Builder. Today, I tried to use Scene Builder and it would not start. No error message was displayed. I uninstalled Scene Builder and reinstalled it... that did not help.
    I noticed the logging.properties file in the "bin" directory. This file contained: java.util.logging.FileHandler.pattern = %t/scenebuilder.log. So, I looked in the system temp directory... no log file.
    The JRE (used by my browsers, etc.) has been updated within the last month, but I am guessing Scene Builder is isolated from any JRE changes, right?
    I downloaded and installed Scene Builder 1.1 (pre-release). Fortunately, Scene Builder 1.1 starts.
    However, I would still like to know why Scene Builder 1.0 does not start. Any ideas on how to troubleshoot the problem?
    Thanks!
    Chris

    Glad it's not just me...
    I had the same problem.  Either it downloaded a patch and fixed itself, or this worked:
    Go to Control Panel / Add / remove programs         (in Control Panel / all control panel items / Programs and Features / Add remove programs)
    Right click on Adobe Reader and select Change.
    Choose Repair
    This appears to have reinstalled the Core DLL file, and it seems to be working normally now.
    Good luck

Maybe you are looking for