FXML file not opening in SceneBuilder - java

I have an FXML file: main-view.fxml which functions perfectly fine, displaying eveything as expected when run within the project and showing zero errors in IntelliJ's FXML editor. However it is unable to be seen in intelliJ's built-in scene builder or in the standalone one. I've tested my other files and they all seem to be working as expected. I've also uninstalled and reinstalled the standalone scene builder.
I've searched around and I think there's a problem with the root Node or one of my imports but they're all the same as my other files. I've also gone through the entire file and haven't found an issue.
Link to FXML file in question: here (It's very long)

Thanks to the suggestion from #kleopatra I was able to find the problem:
It seems I had a closing <rowConstraints/> tag without an opening one that didn't impact functionality but caused the file to not open in Scene Builder.
Hopefully this will help those in a similar spot in the future.

Related

Can't open file in java-eclipse neon

I am just starting off in Java and trying to follow buckythenewboston on you tube. I have java and eclipse neon both downloaded correctly. However, when I create a new project like he showed in the video, I click finish and nothing shows up, in the video it showed on the side there should be a like java symbol with the name of the project I created. Well nothing happens it is blank on my screen. I tried opening a file from the work space in my C drive and that doesn't work either as nothing shows up so I can create a class. I know there is a couple of forum questions with similar title but that is different I think as they can at least get code in where I can't. Any explanation as what is going on would be helpful. I also tried to go to file-import-existing project... but the existing project part isn't an option.
Thanks in advance.
go into your workspace directory and delete .metadata folder, then restart eclipse
Close all perspectives and open a new one, the one you like.

How to access SceneBuilder 2 samples through netBeans

I am trying to access and Run the IssueTrackingLite.fxml file from the Scene Builder 2 samples which I have downloaded.
I have unzipped/extracted the whole samples zip file into the Netbeans Projects folder in my workspace folder, which I use to run JavaFx samples.
But the neither the the entire SB 2 samples zip file, or any of the sample files contained there-in(IssueTrackingLite.fxml, SceneBuilder Hello World etc), appear in the NetBeans projects folder when I try to find/open them through -Open- Projects- in the NetBeans IDE.
What is the correct method of accessing all of the sample files in the Scene Builder 2 samples zip file i have downloaded.???
I have Scene Builder 2 succesfully downloaded and configured to run through the NetBeans IDE and I can open and create a new FXMLDocument.fxml/project in the Scene Builder window through NetBeans.
It worked for me, I will go through some details in case it is of use.
I followed the first link you gave:
http://www.oracle.com/technetwork/java/javafxscenebuilder-1x-archive-2199384.html
Clicked the accept license. and then
http://download.oracle.com/otn/java/javafx_scenebuilder/2.0-b20/javafx_scenebuilder_samples-2_0.zip
unzipped the javafx_scenebuilder_samples-2_0.zip file.
Used File -> Open Project. Selected the IssueTrackingLite folder. (Note if a folder doesn't have one of the kinds of files Netbeans looks for you can't select it. In this case I believe it is looking for an nbproject subdirectory and a build.xml file, both of which are in that directory. If you get one of the bundles of Netbeans from https://netbeans.org/downloads/index.html that doesn't include Java SE support. ie( C++ or HTML 5 & PHP) it would also might not recognize this project type. )
I had an issue where after openning the project it complained there were unresolved dependencies which turned out to be, that it needed a platform called JDK 1.8. It was solved fairly easily by adding a Java Platform. Hopefully you won't have that issue.
After that Run -> Build Project and Run -> Run Project both worked.
Double clicking the IssueTrackingLite.fxml file in the Projects tab, brought up Scene Builder.
Glad indeed that those links were of some use to you and thanks for your advice on resolving possible and potential pitfalls.
In the interim I discovered that the problem was that although I had scene builder 2 installed and all of the necessary samples unzipped etc into the correct directory, in the NetBeans IDE which I am using for all of the JavaFX/ Scene Builder samples, I hadn't established a correct pathfile within NetBeans IDE setup / configuration... as to where the Scene Builder standalone tool is located .... everything was in the right place, just not able to talk to each other.
Thunderbirds are GO ... for now ...

Why does this "new ImageIcon(getClass().getResource("files/icon.png")).getImage();" make my Program invisible?

I wrote this
Image icon = new ImageIcon(getClass().getResource("files/icon.png")).getImage();
in a JFrame-extending class to then set the icon of the frame with
this.setIconImage(icon);
I do it this way, intead of by simply using the Path, because otherwise the Icon would disappear, if I exported my Project as an executable .jar. (as seen here: Once exported, java cannot find/draw images)
The problem that occurs now is, that the executable .jar works the way it should (It creates a folder, as well as a .xml-file and writes into it), but without generating a visible frame.
If I run the program in eclipse however, everything works fine and I see the frame.
I found out, that the problem has to be in the creation of an ImageIcon, because if I run
getClass().getResource("files/icon.png");
everything works fine.
The file is at it's place, too, so this shouldn't be the mistake.
Hope you can help me and thanks in advance.
Okay guys, it was all my fault...
#JBNizet you had the right clue again... it was the case of the path "files/icon.png" -> "Files/icon.png"

How to refactor properly in Netbeans?

I'm working with JavaFX and whenever I move a class to another package I have to update all my FXML files to point to the correct location of classes.
In Eclipse you get an option to apply refactoring changes to the XML files and even non-code text files. However Netbeans only makes changes in Java code and nothing else.
Is there a workaround for this problem?

Executable jar file won't run after doing some updates

I am working on Java project (A terraria like sandbox game) and I have come across something that I just don't understand. I have been exporting the project as .jar's as I go along to upload and share with my friends, but the last time I did this, the .jar won't run, but when I run it in eclipse, it runs fine. When I try to run the jar all it does is lose focus on the explorer window for a split second, then goes back. I have tried many things, like changing the main class, changing the META, and moving the files to specific packages, but nothing is working.
The project is 9 classes, so I won't paste all the code for it here, but the latest, non-working source code can be found here (http://www.mediafire.com/?fiw6wq73j7cff4t), the non-working jar here (http://www.mediafire.com/?bhjo162oh3hi2j9), and the working jar here (http://www.mediafire.com/?h918s8xpyxw4psr). If someone with more experience in java could please take a look at this it would be much appreciated.
One of the things I tried was not adding the JPanel (the game), and just leaving the splash screen, and the jar worked. This shows that it must be a problem in the coding somewhere.
Thanks for the time,
I.D.
Couldn't find message comes from your ReadMap class. So check which circumstance leads to this error. Most likely you did not add all classes or other files to your JAR, so file is not found. Check that all needed files are added to exported JAR in Eclipse export dialog. It's also a good idea to provide more debugging info (stacktrace is ok), especially when you are studying. BTW, cool game :)

Categories