Can not open FXML after a while
Asked Answered
Z

8

9

I have a problem with my JavaFX Scene Builder v2.0-b14.

From time to time, the FXML can't get opened. Even if i remove everything from the FXML except the root.
In the taskbar, it looks like this:
can not open FXML

If i rename the File, i can open the FXML normally.
renamed FXML opens normally

Does anyone know/had this problem, or know where the SceneBuilder caches such things?

greetings,
Kalasch

Zonazonal answered 1/4, 2014 at 8:33 Comment(1)
Thanks. I have this issue as well. It's a pain in the ... :) Did anyone file a bug for this issue?Calcariferous
B
29

Even though this question has been asked long time ago and it already got an accepted answer, I want to contribute my solution to this problem because it differs from the other solutions and in addition is very simple.

This particular problem happened to me just a few mins ago and all I took to solve was:

Windows XP/7

  • Opening the Windows Taskmanager
  • Switch to the applications tab
  • Right click the SceneBuilder (named: yourFileName.fxml)
  • Select 'Maximize'

Windows 8+

  • Opening the Windows Taskmanager
  • Switch to Processes Tab
  • Click the dropbown for JavaFX Scene Builder x.x.exe
  • Find the FXML file that is not opening
  • Right-Click > Press Maximize

Description above works for Windows OS, on other OS the corresponding application managing program should do the same.

That worked for me just perfect. No copying and/or overwriting needed.

Boschvark answered 26/8, 2014 at 9:26 Comment(3)
thanks ifLoop, i will try it the next time i get the error. ;-)Zonazonal
this works for me too, but please add to your question to window and maximize the window again to fix this issue permanently.Zonazonal
This works, but once it's maximized, I dragged down on the titlebar and was able to resize again, otherwise it disappeared again.Chequer
Z
4

A simple workaround is:

  • copy the fxml in some other place
  • open it
  • save it to the original place(overwrite old)

That is just a workaround, but works.
It would be great if some other, better solution is found for this.

Zonazonal answered 2/4, 2014 at 7:28 Comment(1)
That's what I did for a while, but for some reason this stopped working for me recently as well :/Ellsworth
T
2

So try this: Copy your fxml file in some other place. Open JavaFx scen builder and create your scene (some very simple'even with only anchor pane and one label or something ) and save in the place of your fxml on the project. Now try if you can open this by double click. If yes, just copy xml from your orginal file and replace the xml in the that you just created.

Tijuanatike answered 2/4, 2014 at 7:11 Comment(2)
thanks for your efforts, your answer brought me to the workaround that works for me.Zonazonal
You my friend, are my hero of the day! Had the same issue. Tried the solution of Kalaschni but didn't do the trick.. yours did! Thank you!Layton
T
0

I had this same problem and here's how I've managed to solve it.

  1. Open JavaFX Scene Builder.
  2. Drag and drop the file from the Eclipse (or Netbeans) into Scene Builder.
  3. Edit the scene that you opened.
  4. Now, click File -> Save as... -> Choose the location of yout FilterBox.fxml file and overwrite it.
  5. Now you are able to open *.fxml file in Netbeans just by doble-click on the file
Tijuanatike answered 1/4, 2014 at 19:19 Comment(1)
i can not drag and drop into my scene builder.. neither from netbeans nor from windows explorer.Zonazonal
H
0

I ran in to this several times while using Netbeans, sometimes when it was opened in the Netbeans editor it added extra namespace declarations in the root element.

e.g.

<AnchorPane xmlns:fx="http://javafx.com/fxml/1" id="AnchorPane" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1">
    <children>

    </children>
</AnchorPane>

Deleting the second instance of the namespace allowed it to be openend and loaded properly again every time.

Hessler answered 2/4, 2014 at 14:5 Comment(1)
i have tried to replace hole fxml several times by pasting simple fxml structure like an anchorpane. But this brought no success for me.Zonazonal
C
0

As Kalaschni said:

A simple workaround is:

copy the fxml in some other place
open it
save it to the original place(overwrite old)

works ok on win 8.1 and win 7 but u lose your relative paths to CSS and so on ...

and as ifLoop said:

Opening the Windows Taskmanager
Switch to the applications tab
Right click the SceneBuilder (named: yourFileName.fxml)
Select 'Maximize'

works on Win8.1 and 7 ... no other side effects :) wishi could comment this but dont have enough reputation ...

Coryza answered 10/9, 2014 at 12:21 Comment(0)
J
0

Best way is:

  1. Open Scene Builder from Desktop
  2. Go to File -> Open Recent
  3. Click on Clear Menu
Janellajanelle answered 4/11, 2014 at 20:29 Comment(0)
C
0

Thanks you ifloop and Dean Meehan. You helped me find my solution:

private Stage stage;
private Preferences prefs = Preferences.userNodeForPackage(getClass());

@Override
public void start(Stage stage) throws Exception {
    this.stage = stage;

...

    double x = prefs.getDouble("X", 0);
    double y = prefs.getDouble("Y", 0);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

// The following four lines of code return the application to the screen.
    if(x<0 || x>screenSize.getWidth())
        x = 0;

    if(y<0 || y>screenSize.getHeight())
        y = 0;

    stage.setX(x);
    stage.setY(y);

...

    stage.show();
}

@Override
public void stop() throws Exception {

...

    double x = stage.getX();
    double y = stage.getY();

// if the window has been minimized, you will get x = -32000.0 and y=-32000.0
    if(x>=0)
        prefs.putDouble("X", x);
    if(y>=0)
        prefs.putDouble("Y", y);
}
Corolla answered 22/3, 2019 at 12:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.