Skip to content
Snippets Groups Projects
Commit 0e9ffd63 authored by vitawrap's avatar vitawrap
Browse files

Java: JNI + FXML

parent 97d8c560
No related branches found
No related tags found
No related merge requests found
...@@ -61,7 +61,7 @@ testmemorycheck : $(TEST) ...@@ -61,7 +61,7 @@ testmemorycheck : $(TEST)
$(ODIR)/%.o : $(SDIR)/%.c $(DEP) $(ODIR)/%.o : $(SDIR)/%.c $(DEP)
$(CC) $(FLAGS) -o $@ $< $(CC) $(FLAGS) -o $@ $<
$(ODIR)/application_Scheduling.o : $(SDIR)/application_Scheduling.c $(DEP) $(ODIR)/Scheduling.o : $(SDIR)/Scheduling.c $(DEP)
$(CC) $(FLAGS) $(JINCLUDES) -o $@ $< $(CC) $(FLAGS) $(JINCLUDES) -o $@ $<
$(PROG) : $(OBJ) $(ODIR)/main.o $(PROG) : $(OBJ) $(ODIR)/main.o
......
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class Scheduling */
#ifndef _Included_Scheduling
#define _Included_Scheduling
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: Scheduling
* Method: runSchedule
* Signature: (Ljava/lang/String;Ljava/lang/String;III)V
*/
JNIEXPORT void JNICALL Java_Scheduling_runSchedule
(JNIEnv *, jclass, jstring, jstring, jint, jint, jint);
#ifdef __cplusplus
}
#endif
#endif
import java.io.IOException;
import javafx.application.Application; import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.layout.StackPane; import javafx.scene.control.SplitPane;
import javafx.stage.Stage; import javafx.stage.Stage;
public class App extends Application { public class App extends Application {
...@@ -10,9 +13,15 @@ public class App extends Application { ...@@ -10,9 +13,15 @@ public class App extends Application {
@Override @Override
public void start(Stage primaryStage) throws Exception { public void start(Stage primaryStage) throws Exception {
StackPane root = new StackPane(); try {
primaryStage.setTitle("Hello World"); SplitPane root = FXMLLoader.load(getClass().getResource("resources/ProjetView.fxml"));
primaryStage.setScene(new Scene(root, 800, 600)); primaryStage.setTitle("Hello World");
primaryStage.show(); primaryStage.setScene(new Scene(root, 800, 600));
primaryStage.show();
}
catch (IOException e)
{
System.err.println("FXML indisponible.");
}
} }
} }
public class Scheduling {
public static native void runSchedule(String instanceInFile, String scheduleOutFile, int m, int preemption, int balanced);
}
No preview for this file type
File added
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.canvas.Canvas?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Separator?>
<?import javafx.scene.control.Spinner?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Text?>
<SplitPane dividerPositions="0.29797979797979796" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/19">
<items>
<AnchorPane maxWidth="-Infinity" minHeight="0.0" minWidth="172.0" prefHeight="160.0" prefWidth="172.0">
<children>
<VBox prefHeight="398.4" prefWidth="175.2" spacing="10.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="File path:" />
<TextField fx:id="_filename" promptText="Scheduling instance file" />
<Separator prefWidth="200.0" />
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Machine count:" />
<Spinner fx:id="_machineCount" editable="true" />
<Separator prefWidth="200.0" />
<CheckBox fx:id="_balanced" mnemonicParsing="false" selected="true" text="Use balanced trees" />
<CheckBox fx:id="_preemptive" mnemonicParsing="false" text="Use SRPT over SPT" />
<Pane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="0.0" prefWidth="0.0" VBox.vgrow="ALWAYS" />
<Button alignment="BOTTOM_CENTER" defaultButton="true" mnemonicParsing="false" onAction="#submitToDiagram" text="Display and Save" />
</children>
</VBox>
</children></AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<BorderPane prefHeight="398.4" prefWidth="417.6" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<center>
<Canvas fx:id="_canvas" height="380.0" width="400.0" BorderPane.alignment="CENTER" />
</center>
</BorderPane>
</children></AnchorPane>
</items>
</SplitPane>
#include <jni.h>
#include "schedule.h"
#include "Scheduling.h"
JNIEXPORT void JNICALL Java_Scheduling_runSchedule
(JNIEnv * env, jclass , jstring, jstring, jint, jint, jint)
{
//const char * mystring = (* env )->GetStringUTFChars(env, s, NULL);
}
#include <jni.h>
#include "schedule.h"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment