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

有帮助吗?

解决方案

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.

其他提示

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.

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.

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

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.

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 ...

Best way is:

  1. Open Scene Builder from Desktop
  2. Go to File -> Open Recent
  3. Click on Clear Menu

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);
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top