2023年2月18日11:44:54
parent
31905312fc
commit
5bb53a5d51
|
|
@ -40,6 +40,8 @@ public class HomeController implements Serializable {
|
||||||
private SimpleDoubleProperty width = new SimpleDoubleProperty(0.0);
|
private SimpleDoubleProperty width = new SimpleDoubleProperty(0.0);
|
||||||
private SimpleDoubleProperty height = new SimpleDoubleProperty(0.0);
|
private SimpleDoubleProperty height = new SimpleDoubleProperty(0.0);
|
||||||
private AnchorPane root;
|
private AnchorPane root;
|
||||||
|
private AnchorPane md5;
|
||||||
|
private AnchorPane spring_security;
|
||||||
|
|
||||||
public static final String color_cell = "#f4f4f4";
|
public static final String color_cell = "#f4f4f4";
|
||||||
|
|
||||||
|
|
@ -51,12 +53,20 @@ public class HomeController implements Serializable {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void md5_menu_item() {
|
public void md5_menu_item() {
|
||||||
md5();
|
boolean flag = false;
|
||||||
|
if (md5 != null){
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
md5(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void spring_security_menu_item() {
|
public void spring_security_menu_item() {
|
||||||
spring();
|
boolean flag = false;
|
||||||
|
if (spring_security != null){
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
spring(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
|
@ -95,11 +105,19 @@ public class HomeController implements Serializable {
|
||||||
init();
|
init();
|
||||||
listView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
listView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
if (newValue != null) {
|
if (newValue != null) {
|
||||||
|
boolean flag = false;
|
||||||
|
|
||||||
if (newValue.getIndex() == 0) {
|
if (newValue.getIndex() == 0) {
|
||||||
md5();
|
if (md5 != null){
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
md5(flag);
|
||||||
}
|
}
|
||||||
if (newValue.getIndex() == 1) {
|
if (newValue.getIndex() == 1) {
|
||||||
spring();
|
if (spring_security != null){
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
spring(flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -163,16 +181,39 @@ public class HomeController implements Serializable {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
md5();
|
md5(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void spring() {
|
private void spring(boolean flag) {
|
||||||
listView.getSelectionModel().select(1);
|
listView.getSelectionModel().select(1);
|
||||||
|
if (!flag){
|
||||||
try {
|
try {
|
||||||
root = FXMLLoader.load(ResourcesUtils.getResource("spring-security"));
|
root = FXMLLoader.load(ResourcesUtils.getResource("spring-security"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
spring_security = root;
|
||||||
|
}else {
|
||||||
|
root = spring_security;
|
||||||
|
}
|
||||||
|
common_method();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void md5(boolean flag) {
|
||||||
|
//默认选择第一个
|
||||||
|
listView.getSelectionModel().select(0);
|
||||||
|
|
||||||
|
if (!flag){
|
||||||
|
try {
|
||||||
|
root = FXMLLoader.load(ResourcesUtils.getResource("md5"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
md5 = root;
|
||||||
|
}else {
|
||||||
|
root = md5;
|
||||||
|
}
|
||||||
common_method();
|
common_method();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -203,14 +244,4 @@ public class HomeController implements Serializable {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void md5() {
|
|
||||||
//默认选择第一个
|
|
||||||
listView.getSelectionModel().select(0);
|
|
||||||
try {
|
|
||||||
root = FXMLLoader.load(ResourcesUtils.getResource("md5"));
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
common_method();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -19,6 +19,7 @@ import javafx.fxml.FXML;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
|
import javafx.geometry.Rectangle2D;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
|
@ -62,7 +63,6 @@ public class VideoController {
|
||||||
private static ObservableList<File> files = FXCollections.observableArrayList();
|
private static ObservableList<File> files = FXCollections.observableArrayList();
|
||||||
private static String abpath = System.getProperty("user.dir") + "/";
|
private static String abpath = System.getProperty("user.dir") + "/";
|
||||||
private static BufferedWriter bw = null;
|
private static BufferedWriter bw = null;
|
||||||
public ScrollPane scrollPane;
|
|
||||||
private MediaPlayer mp;
|
private MediaPlayer mp;
|
||||||
private final SimpleBooleanProperty isplaying = new SimpleBooleanProperty(false);
|
private final SimpleBooleanProperty isplaying = new SimpleBooleanProperty(false);
|
||||||
private final SimpleIntegerProperty playindex = new SimpleIntegerProperty(1);
|
private final SimpleIntegerProperty playindex = new SimpleIntegerProperty(1);
|
||||||
|
|
@ -71,6 +71,7 @@ public class VideoController {
|
||||||
private final Random ran = new Random();
|
private final Random ran = new Random();
|
||||||
|
|
||||||
private HBox hbox;
|
private HBox hbox;
|
||||||
|
|
||||||
private static final double gap = 5.0D;
|
private static final double gap = 5.0D;
|
||||||
private final int number = SpectrumUtils.CELL_NUMBER;
|
private final int number = SpectrumUtils.CELL_NUMBER;
|
||||||
private ObservableList<SimpleFloatProperty> height;
|
private ObservableList<SimpleFloatProperty> height;
|
||||||
|
|
@ -159,6 +160,12 @@ public class VideoController {
|
||||||
@FXML
|
@FXML
|
||||||
private MediaView mv;
|
private MediaView mv;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private AnchorPane video_root;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private AnchorPane mv_an;
|
||||||
|
|
||||||
public void full_screen() {
|
public void full_screen() {
|
||||||
|
|
||||||
AnchorPane root = null;
|
AnchorPane root = null;
|
||||||
|
|
@ -190,6 +197,7 @@ public class VideoController {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
|
||||||
files = getMusicFiles();
|
files = getMusicFiles();
|
||||||
initListView();
|
initListView();
|
||||||
medias = getMusicMedias();
|
medias = getMusicMedias();
|
||||||
|
|
@ -218,9 +226,12 @@ public class VideoController {
|
||||||
this.sb = new StringBuffer(files.get(this.playindex.get()).getName());
|
this.sb = new StringBuffer(files.get(this.playindex.get()).getName());
|
||||||
this.sb = new StringBuffer(this.sb.substring(0, this.sb.length() - 4));
|
this.sb = new StringBuffer(this.sb.substring(0, this.sb.length() - 4));
|
||||||
this.mp.setVolume(sl_vol_num);
|
this.mp.setVolume(sl_vol_num);
|
||||||
|
this.mv.setMediaPlayer(mp);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.playindex.addListener((observable, oldValue, newValue) -> VideoController.this.myPlay());
|
this.playindex.addListener((observable, oldValue, newValue) -> VideoController.this.myPlay());
|
||||||
|
this.mv.setPreserveRatio(false);
|
||||||
|
this.mv.fitWidthProperty().bind(video_root.prefWidthProperty().subtract(300));
|
||||||
|
|
||||||
//设置按钮
|
//设置按钮
|
||||||
set_button();
|
set_button();
|
||||||
|
|
@ -508,7 +519,7 @@ public class VideoController {
|
||||||
|
|
||||||
public void myPlay() {
|
public void myPlay() {
|
||||||
this.mp.dispose();
|
this.mp.dispose();
|
||||||
this.mp = new MediaPlayer(this.medias.get(this.playindex.get()));
|
this.mp = new MediaPlayer(medias.get(this.playindex.get()));
|
||||||
initProgressBar(mp);
|
initProgressBar(mp);
|
||||||
this.mp.setOnReady(() -> {
|
this.mp.setOnReady(() -> {
|
||||||
VideoController.this.mp.play();
|
VideoController.this.mp.play();
|
||||||
|
|
@ -572,7 +583,7 @@ public class VideoController {
|
||||||
if (!empty && item != null) {
|
if (!empty && item != null) {
|
||||||
sb = new StringBuffer(item.getName());
|
sb = new StringBuffer(item.getName());
|
||||||
Text text = new Text(sb.substring(0, sb.length() - 4));
|
Text text = new Text(sb.substring(0, sb.length() - 4));
|
||||||
text.setWrappingWidth(300.0D);
|
text.setStrokeWidth(300);
|
||||||
text.setTextAlignment(TextAlignment.CENTER);
|
text.setTextAlignment(TextAlignment.CENTER);
|
||||||
if (this.getIndex() == VideoController.this.playindex.get()) {
|
if (this.getIndex() == VideoController.this.playindex.get()) {
|
||||||
text.setFont(Font.font(16.0D));
|
text.setFont(Font.font(16.0D));
|
||||||
|
|
@ -582,7 +593,7 @@ public class VideoController {
|
||||||
//text.setFill(Color.WHITE);
|
//text.setFill(Color.WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setAlignment(Pos.CENTER);
|
this.setAlignment(Pos.CENTER_LEFT);
|
||||||
this.setGraphic(text);
|
this.setGraphic(text);
|
||||||
this.setOpacity(1.0D);
|
this.setOpacity(1.0D);
|
||||||
this.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, (CornerRadii)null, (Insets)null)));
|
this.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, (CornerRadii)null, (Insets)null)));
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
<AnchorPane fx:id="video_root" prefHeight="649.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhangmeng.tools.controller.VideoController">
|
<AnchorPane fx:id="video_root" prefHeight="649.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhangmeng.tools.controller.VideoController">
|
||||||
|
|
||||||
<HBox alignment="CENTER" layoutY="479.0" prefHeight="49.0" prefWidth="1200.0" spacing="20.0" style="-fx-background-color: #6666" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
|
<HBox fx:id="icon_hbox" alignment="CENTER" layoutY="479.0" prefHeight="49.0" prefWidth="1200.0" spacing="20.0" style="-fx-background-color: #6666" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
|
||||||
<children>
|
<children>
|
||||||
<ImageView fx:id="iv_set" fitHeight="33.0" fitWidth="77.0" pickOnBounds="true" preserveRatio="true">
|
<ImageView fx:id="iv_set" fitHeight="33.0" fitWidth="77.0" pickOnBounds="true" preserveRatio="true">
|
||||||
<image>
|
<image>
|
||||||
|
|
@ -54,12 +54,11 @@
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
<RXMediaProgressBar fx:id="progressBar" layoutX="92.0" layoutY="542.0" prefHeight="11.0" prefWidth="961.0" AnchorPane.bottomAnchor="71.0" AnchorPane.leftAnchor="185.0" AnchorPane.rightAnchor="101.0" />
|
<RXMediaProgressBar fx:id="progressBar" layoutX="92.0" layoutY="542.0" prefHeight="11.0" prefWidth="961.0" AnchorPane.bottomAnchor="71.0" AnchorPane.leftAnchor="185.0" AnchorPane.rightAnchor="101.0" />
|
||||||
<ScrollPane fx:id="scrollPane" prefHeight="551.0" prefWidth="300.0" AnchorPane.bottomAnchor="98.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0">
|
|
||||||
<content>
|
<ListView prefHeight="551.0" prefWidth="300.0" AnchorPane.bottomAnchor="98.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" fx:id="listView" />
|
||||||
<ListView fx:id="listView" prefHeight="${scrollPane.height}" prefWidth="295.0" />
|
|
||||||
</content>
|
|
||||||
</ScrollPane>
|
|
||||||
<Label fx:id="label_name" layoutX="21.0" layoutY="564.0" text="芊芊墨客-音乐相随" AnchorPane.bottomAnchor="68.0" AnchorPane.leftAnchor="21.0" />
|
<Label fx:id="label_name" layoutX="21.0" layoutY="564.0" text="芊芊墨客-音乐相随" AnchorPane.bottomAnchor="68.0" AnchorPane.leftAnchor="21.0" />
|
||||||
<Label fx:id="label_time" layoutX="1121.0" layoutY="564.0" text="00:00" AnchorPane.bottomAnchor="68.0" AnchorPane.rightAnchor="44.0" />
|
<Label fx:id="label_time" layoutX="1121.0" layoutY="564.0" text="00:00" AnchorPane.bottomAnchor="68.0" AnchorPane.rightAnchor="44.0" />
|
||||||
<MediaView id="mv" fx:id="mv" fitHeight="679" fitWidth="1200" layoutX="353.0" layoutY="268.0" AnchorPane.bottomAnchor="100.0" AnchorPane.leftAnchor="300.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
<MediaView fx:id="mv" style="-fx-border-color: red" layoutX="306.0" layoutY="48.0" fitHeight="680.0" fitWidth="1024.0" AnchorPane.bottomAnchor="99.0" AnchorPane.leftAnchor="300.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
|
</MediaView>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue