This discussion is archived
3 Replies Latest reply: Nov 18, 2012 11:48 AM by J. Ishikawa RSS

FMXL and acces to a java var

968413 Newbie
Currently Being Moderated
Hi, im trying to do a mvc with my fxml files but i have a problem for the view.

Here is my code views.fxml:
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane id="AnchorPane" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml">
    <fx:include source="menu.fxml"/>
  <fx:include source="$views"/>
</AnchorPane>
My MenuController.java :
   public void changetoTeam(ActionEvent event) {

        views = "team.fxml";
        try {
            AnchorPane page = (AnchorPane) FXMLLoader.load(Main.class.getResource("view/views.fxml"));
            Scene scene = new Scene(page);

            Main.changeScene(scene, Main.tmpStage);
        } catch (Exception ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
I cant get it to work !

Could you help me? Thanks !

Edited by: 965410 on 15 oct. 2012 07:56

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points