added splitpane
This commit is contained in:
parent
c9cc980e88
commit
fab130968c
@ -1,18 +1,28 @@
|
||||
package sarsoo.fmframework.fx;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
import sarsoo.fmframework.util.Reference;
|
||||
|
||||
public class FmFramework extends Application {
|
||||
|
||||
private Stage stage;
|
||||
private Scene rootScene;
|
||||
|
||||
@Override
|
||||
public void start(Stage stage) throws Exception {
|
||||
this.stage = stage;
|
||||
|
||||
Parent root = FXMLLoader.load(getClass().getResource("ui/main.fxml"));
|
||||
|
||||
Scene scene = new Scene(root, 800, 400);
|
||||
|
||||
rootScene = scene;
|
||||
// scene.getStylesheets().add("styles/style.css");
|
||||
|
||||
stage.setTitle("FM Framework");
|
||||
@ -25,4 +35,11 @@ public class FmFramework extends Application {
|
||||
launch(args);
|
||||
}
|
||||
|
||||
public void changeScene() throws IOException {
|
||||
Parent root = FXMLLoader.load(getClass().getResource("ui/changed.fxml"));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
18
fmframework/src/sarsoo/fmframework/fx/Stats.java
Normal file
18
fmframework/src/sarsoo/fmframework/fx/Stats.java
Normal file
@ -0,0 +1,18 @@
|
||||
package sarsoo.fmframework.fx;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
|
||||
public class Stats {
|
||||
|
||||
/*@FXML
|
||||
private static Label scrobblesToday;
|
||||
|
||||
*//**
|
||||
* @param scrobbles
|
||||
*//*
|
||||
public static void updateScrobblesToday(int scrobbles) {
|
||||
|
||||
// scrobblesToday.setText(Integer.toString(scrobbles));
|
||||
}*/
|
||||
}
|
@ -1,21 +1,75 @@
|
||||
package sarsoo.fmframework.fx.controller;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.scene.control.Button;
|
||||
import sarsoo.fmframework.util.FMObjList;
|
||||
import sarsoo.fmframework.util.Getter;
|
||||
import sarsoo.fmframework.util.Reference;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.chart.*;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.collections.FXCollections;
|
||||
|
||||
public class ControllerMain {
|
||||
|
||||
@FXML
|
||||
private Button changeScene;
|
||||
|
||||
private int clicked = 0;
|
||||
private Label labelStatsScrobblesToday;
|
||||
|
||||
@FXML
|
||||
protected void handleButtonClick(ActionEvent event) {
|
||||
JOptionPane.showMessageDialog(null, "Changed");
|
||||
private Label labelStatsUsername;
|
||||
|
||||
@FXML
|
||||
private Label labelStatsScrobblesTotal;
|
||||
|
||||
@FXML
|
||||
private PieChart pieChartGenres;
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
Reference.setUserName("sarsoo");
|
||||
|
||||
labelStatsScrobblesToday.setText(Integer.toString(Getter.getScrobblesToday(Reference.getUserName())));
|
||||
|
||||
labelStatsUsername.setText(Reference.getUserName());
|
||||
|
||||
|
||||
// updateGenrePieChart();
|
||||
|
||||
labelStatsScrobblesTotal.setText(NumberFormat.getInstance().format(Getter.getScrobbles(Reference.getUserName())));
|
||||
|
||||
}
|
||||
|
||||
public void updateGenrePieChart() {
|
||||
|
||||
String[] names = {
|
||||
"rock",
|
||||
"rap",
|
||||
"classic rock",
|
||||
"pop punk",
|
||||
"electronic",
|
||||
"metal",
|
||||
"grime",
|
||||
"classic rap",
|
||||
"indie",
|
||||
"jazz",
|
||||
"blues",
|
||||
"core"
|
||||
};
|
||||
|
||||
ObservableList<PieChart.Data> pieChartData =
|
||||
FXCollections.observableArrayList(
|
||||
// new PieChart.Data("rap", Getter.getUserTag(Reference.getUserName(), "rap").getTotalUserScrobbles()),
|
||||
new PieChart.Data("rock", Getter.getUserTag(Reference.getUserName(), "rap").getTotalUserScrobbles()));
|
||||
pieChartGenres = new PieChart(pieChartData);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
13
fmframework/src/sarsoo/fmframework/fx/styles/mainPane.css
Normal file
13
fmframework/src/sarsoo/fmframework/fx/styles/mainPane.css
Normal file
@ -0,0 +1,13 @@
|
||||
.vBoxStats{
|
||||
-fx-background-color: #001a44;
|
||||
}
|
||||
|
||||
.gridPane{
|
||||
|
||||
-fx-background-color: #a2aec1;
|
||||
}
|
||||
|
||||
.vBoxStatsLabel{
|
||||
|
||||
-fx-text-fill: white;
|
||||
}
|
12
fmframework/src/sarsoo/fmframework/fx/ui/changed.fxml
Normal file
12
fmframework/src/sarsoo/fmframework/fx/ui/changed.fxml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
|
||||
<VBox 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">
|
||||
<children>
|
||||
<Label text="CHANGED" />
|
||||
</children>
|
||||
</VBox>
|
@ -1,25 +1,90 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.chart.*?>
|
||||
<?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>
|
||||
<BorderPane fx:id="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">
|
||||
<top>
|
||||
<MenuBar fx:id="menuBar" BorderPane.alignment="CENTER">
|
||||
<menus>
|
||||
<Menu fx:id="menuLookup" mnemonicParsing="false" text="Lookup">
|
||||
<items>
|
||||
<MenuItem fx:id="menuItemTrack" mnemonicParsing="false" text="Track" />
|
||||
<MenuItem fx:id="menuItemAlbum" mnemonicParsing="false" text="Album" />
|
||||
<MenuItem fx:id="menuItemArtist" mnemonicParsing="false" text="Artist" />
|
||||
</items>
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="Edit">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="Delete" />
|
||||
</items>
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="Help">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="About" />
|
||||
</items>
|
||||
</Menu>
|
||||
</menus>
|
||||
</MenuBar>
|
||||
</top>
|
||||
<bottom>
|
||||
<VBox fx:id="vBoxStats" prefHeight="19.0" prefWidth="600.0" BorderPane.alignment="CENTER">
|
||||
<children>
|
||||
<Button fx:id="changeScene" mnemonicParsing="false" onAction="#handleButtonClick" text="Change Scene" GridPane.halignment="CENTER" GridPane.rowIndex="1" />
|
||||
<FlowPane fx:id="flowPlaneStats" alignment="TOP_RIGHT" prefHeight="20.0" prefWidth="600.0" styleClass="vBoxStats" stylesheets="@../styles/mainPane.css" VBox.vgrow="NEVER">
|
||||
<children>
|
||||
<Label fx:id="labelStatsUsername" styleClass="vBoxStatsLabel" stylesheets="@../styles/mainPane.css" text="user" />
|
||||
<Label fx:id="labelStatsScrobblesToday" styleClass="vBoxStatsLabel" stylesheets="@../styles/mainPane.css" text="scrobblesToday" />
|
||||
<Label fx:id="labelStatsSlash" styleClass="vBoxStatsLabel" stylesheets="@../styles/mainPane.css" text="/" />
|
||||
<Label fx:id="labelStatsScrobblesTotal" styleClass="vBoxStatsLabel" stylesheets="@../styles/mainPane.css" text="scrobblesTotal" />
|
||||
</children>
|
||||
</GridPane>
|
||||
</FlowPane>
|
||||
</children>
|
||||
</VBox>
|
||||
</bottom>
|
||||
<center>
|
||||
<TabPane fx:id="tabPane" prefHeight="200.0" prefWidth="200.0" tabClosingPolicy="UNAVAILABLE" BorderPane.alignment="CENTER">
|
||||
<tabs>
|
||||
<Tab fx:id="tabHome" closable="false" text="home">
|
||||
<content>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
||||
<children>
|
||||
<SplitPane fx:id="splitPaneHome" dividerPositions="0.6237458193979933" prefHeight="327.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<items>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0" />
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
|
||||
<children>
|
||||
<Accordion fx:id="accordionCharts" prefHeight="325.0" prefWidth="222.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<panes>
|
||||
<TitledPane fx:id="titledPaneGenres" animated="false" text="genres">
|
||||
<content>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
||||
<children>
|
||||
<PieChart fx:id="pieChartGenres" layoutX="-189.0" layoutY="-102.0" prefHeight="249.0" prefWidth="220.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</TitledPane>
|
||||
<TitledPane fx:id="titledPaneRap" animated="false" text="rap">
|
||||
<content>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
||||
<children>
|
||||
<PieChart prefHeight="274.0" prefWidth="220.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</TitledPane>
|
||||
</panes>
|
||||
</Accordion>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</items>
|
||||
</SplitPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</Tab>
|
||||
</tabs></TabPane>
|
||||
</center>
|
||||
</BorderPane>
|
||||
|
Loading…
Reference in New Issue
Block a user