I'm working on an JavaFX program which needs to load the fxml source from this URL: http://pastebin.com/raw.php?i=SW5d5ucs
<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="201.0" prefWidth="299.0" style="-fx-background-color: #2B2B2B;" fx:controller="aio_pkhonor.core.ui.crafting.CraftingInterfaceController" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Label alignment="CENTER" layoutX="6.0" layoutY="6.0" prefHeight="51.0" prefWidth="291.0" text="Gem Crafting" textFill="WHITE">
<font>
<Font name="Rod" size="28.0"/>
</font>
</Label>
<Button fx:id="StartButton" layoutX="15.0" layoutY="162.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="273.0" style="-fx-background-color: #1b1b1b;" text="Start Script" textFill="WHITE"/>
<Label layoutX="28.0" layoutY="120.0" text="Gem To Craft : " textFill="WHITE"/>
<ComboBox fx:id="GemComboBox" layoutX="108.0" layoutY="116.0" prefHeight="25.0" prefWidth="163.0" promptText="Select Gem"/>
<RadioButton fx:id="AutoTrainButton" layoutX="24.5439453125" layoutY="57.0" mnemonicParsing="false" text="AutoTrain (Trains Your Acc To 2Bil XP)" textFill="WHITE">
<toggleGroup>
<ToggleGroup fx:id="group"/>
</toggleGroup>
</RadioButton>
<RadioButton fx:id="CustomTrainButton" layoutX="25.0" layoutY="84.0" mnemonicParsing="false" text="Custom" textFill="WHITE" toggleGroup="$group"/>
</children>
</AnchorPane>
I have tried things but can't seem to figure it out, it would be great if someone could help me out.
Assuming you have the controller on your classpath, you can just do
import java.net.URL;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class RemoteFXMLTest extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
Parent root = FXMLLoader.load(new URL("http://pastebin.com/raw.php?i=SW5d5ucs"));
Scene scene = new Scene(root, 600, 400);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Or you could just copy the code, save it to an FXML file, and use it in the standard way...