migrating from jframe to javafx

This commit is contained in:
aj 2018-04-17 15:00:16 -07:00
parent b6bc783e3e
commit c9cc980e88
17 changed files with 88 additions and 14 deletions

View File

@ -2,7 +2,7 @@ package sarsoo.fmframework.drive;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import sarsoo.fmframework.gui.MainMenu; import sarsoo.fmframework.jframe.MainMenu;
import sarsoo.fmframework.util.Getter; import sarsoo.fmframework.util.Getter;
import sarsoo.fmframework.util.Reference; import sarsoo.fmframework.util.Reference;

View File

@ -0,0 +1,28 @@
package sarsoo.fmframework.fx;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class FmFramework extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("ui/main.fxml"));
Scene scene = new Scene(root, 800, 400);
// scene.getStylesheets().add("styles/style.css");
stage.setTitle("FM Framework");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}

View File

@ -0,0 +1,21 @@
package sarsoo.fmframework.fx.controller;
import javax.swing.JOptionPane;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.text.Text;
import javafx.scene.control.Button;
public class ControllerMain {
@FXML
private Button changeScene;
private int clicked = 0;
@FXML
protected void handleButtonClick(ActionEvent event) {
JOptionPane.showMessageDialog(null, "Changed");
}
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sarsoo.fmframework.fx.controller.ControllerMain">
<center>
<GridPane BorderPane.alignment="CENTER">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Button fx:id="changeScene" mnemonicParsing="false" onAction="#handleButtonClick" text="Change Scene" GridPane.halignment="CENTER" GridPane.rowIndex="1" />
</children>
</GridPane>
</center>
</BorderPane>

View File

@ -1,4 +1,4 @@
package sarsoo.fmframework.gui; package sarsoo.fmframework.jframe;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Font; import java.awt.Font;

View File

@ -1,4 +1,4 @@
package sarsoo.fmframework.gui; package sarsoo.fmframework.jframe;
import java.awt.Font; import java.awt.Font;
import java.awt.GridLayout; import java.awt.GridLayout;

View File

@ -1,4 +1,4 @@
package sarsoo.fmframework.gui; package sarsoo.fmframework.jframe;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Font; import java.awt.Font;

View File

@ -1,4 +1,4 @@
package sarsoo.fmframework.gui; package sarsoo.fmframework.jframe;
import java.awt.GridLayout; import java.awt.GridLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;

View File

@ -1,4 +1,4 @@
package sarsoo.fmframework.gui; package sarsoo.fmframework.jframe;
import java.awt.GridLayout; import java.awt.GridLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;

View File

@ -1,4 +1,4 @@
package sarsoo.fmframework.gui; package sarsoo.fmframework.jframe;
import java.awt.GridLayout; import java.awt.GridLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;

View File

@ -1,4 +1,4 @@
package sarsoo.fmframework.gui; package sarsoo.fmframework.jframe;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Font; import java.awt.Font;

View File

@ -1,4 +1,4 @@
package sarsoo.fmframework.gui; package sarsoo.fmframework.jframe;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.GridLayout; import java.awt.GridLayout;

View File

@ -4,7 +4,7 @@ import java.util.ArrayList;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import sarsoo.fmframework.gui.AlbumView; import sarsoo.fmframework.jframe.AlbumView;
import sarsoo.fmframework.net.Network; import sarsoo.fmframework.net.Network;
import sarsoo.fmframework.net.URLBuilder; import sarsoo.fmframework.net.URLBuilder;
import sarsoo.fmframework.parser.Parser; import sarsoo.fmframework.parser.Parser;

View File

@ -1,6 +1,6 @@
package sarsoo.fmframework.music; package sarsoo.fmframework.music;
import sarsoo.fmframework.gui.FMObjView; import sarsoo.fmframework.jframe.FMObjView;
import sarsoo.fmframework.util.Maths; import sarsoo.fmframework.util.Maths;
public abstract class FMObj implements Comparable<FMObj>{ public abstract class FMObj implements Comparable<FMObj>{

View File

@ -4,7 +4,7 @@ import java.util.ArrayList;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import sarsoo.fmframework.gui.TrackView; import sarsoo.fmframework.jframe.TrackView;
import sarsoo.fmframework.net.Network; import sarsoo.fmframework.net.Network;
import sarsoo.fmframework.net.URLBuilder; import sarsoo.fmframework.net.URLBuilder;
//import sarsoo.fmframework.net.TestCall; //import sarsoo.fmframework.net.TestCall;

View File

@ -1,6 +1,6 @@
package sarsoo.fmframework.music; package sarsoo.fmframework.music;
import sarsoo.fmframework.gui.WikiView; import sarsoo.fmframework.jframe.WikiView;
public class Wiki { public class Wiki {
private String date; private String date;

View File

@ -2,7 +2,7 @@ package sarsoo.fmframework.util;
import java.util.ArrayList; import java.util.ArrayList;
import sarsoo.fmframework.gui.FMObjListView; import sarsoo.fmframework.jframe.FMObjListView;
import sarsoo.fmframework.music.Album; import sarsoo.fmframework.music.Album;
import sarsoo.fmframework.music.Artist; import sarsoo.fmframework.music.Artist;
import sarsoo.fmframework.music.FMObj; import sarsoo.fmframework.music.FMObj;