添加影音功能 2023年2月16日11:24:04
parent
5dbaf82835
commit
5658e40512
|
|
@ -10,9 +10,11 @@ import javafx.collections.ObservableList;
|
|||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
|
@ -25,8 +27,6 @@ import java.util.Arrays;
|
|||
*/
|
||||
public class HomeController implements Serializable {
|
||||
|
||||
private SimpleObjectProperty<ResourcesUtils.Menu> menus = new SimpleObjectProperty<>();
|
||||
|
||||
private SimpleDoubleProperty width = new SimpleDoubleProperty(0.0);
|
||||
private SimpleDoubleProperty height = new SimpleDoubleProperty(0.0);
|
||||
private AnchorPane root;
|
||||
|
|
@ -37,6 +37,47 @@ public class HomeController implements Serializable {
|
|||
@FXML
|
||||
private SplitPane splitPane;
|
||||
|
||||
@FXML
|
||||
public void md5_menu_item(){
|
||||
md5();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void spring_security_menu_item(){
|
||||
spring();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void video_menu_item(){
|
||||
load_player(0);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void music_menu_item(){
|
||||
load_player(1);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void vip_parser_menu_item(){
|
||||
load_player(2);
|
||||
}
|
||||
|
||||
public void load_player(int index){
|
||||
AnchorPane fx = null;
|
||||
try {
|
||||
fx = FXMLLoader.load(ResourcesUtils.getResource("player"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Scene scene = new Scene(fx);
|
||||
Stage stage = (Stage) splitPane.getScene().getWindow();
|
||||
stage.setScene(scene);
|
||||
|
||||
ListView<ResourcesUtils.Player> listView = (ListView) fx.lookup("#listView");
|
||||
listView.getSelectionModel().select(index);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
init();
|
||||
|
|
@ -48,23 +89,10 @@ public class HomeController implements Serializable {
|
|||
if (newValue.getIndex() == 1 ){
|
||||
spring();
|
||||
}
|
||||
if (newValue.getIndex() == 2){
|
||||
vip_parser();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void md5_menu_item(){
|
||||
md5();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void spring_security_menu_item(){
|
||||
spring();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
ResourcesUtils.Menu[] values = ResourcesUtils.Menu.values();
|
||||
ObservableList<ResourcesUtils.Menu> list = FXCollections.observableArrayList();
|
||||
|
|
@ -74,6 +102,7 @@ public class HomeController implements Serializable {
|
|||
}
|
||||
|
||||
private void spring(){
|
||||
listView.getSelectionModel().select(1);
|
||||
try {
|
||||
root = FXMLLoader.load(ResourcesUtils.getResource("spring-security"));
|
||||
} catch (IOException e) {
|
||||
|
|
@ -82,15 +111,6 @@ public class HomeController implements Serializable {
|
|||
common_method();
|
||||
}
|
||||
|
||||
private void vip_parser(){
|
||||
try {
|
||||
root = FXMLLoader.load(ResourcesUtils.getResource("vip-parser"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
common_method();
|
||||
}
|
||||
|
||||
private void common_method(){
|
||||
splitPane.getItems().remove(1);
|
||||
splitPane.getItems().add(1, root);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
package com.zhangmeng.tools.controller;
|
||||
|
||||
/**
|
||||
* @author : 芊芊墨客
|
||||
* @version : 1.0
|
||||
* @date : 2023-02-16 11:09
|
||||
*/
|
||||
public class MusicController {
|
||||
}
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
package com.zhangmeng.tools.controller;
|
||||
|
||||
import com.zhangmeng.tools.utils.ResourcesUtils;
|
||||
import javafx.beans.property.SimpleDoubleProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.ListView;
|
||||
import javafx.scene.control.SplitPane;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author : 芊芊墨客
|
||||
* @version : 1.0
|
||||
* @date : 2023-02-16 10:04
|
||||
*/
|
||||
public class PlayerController {
|
||||
|
||||
private SimpleDoubleProperty width = new SimpleDoubleProperty(0.0);
|
||||
private SimpleDoubleProperty height = new SimpleDoubleProperty(0.0);
|
||||
private AnchorPane root;
|
||||
|
||||
@FXML
|
||||
private ListView<ResourcesUtils.Player> listView;
|
||||
|
||||
@FXML
|
||||
private SplitPane splitPane;
|
||||
|
||||
@FXML
|
||||
public void md5_menu_item(){
|
||||
load_encrypt();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void spring_security_menu_item(){
|
||||
load_encrypt();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void video_menu_item(){
|
||||
video();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void music_menu_item(){
|
||||
music();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void vip_parser_menu_item(){
|
||||
vip_parser();
|
||||
}
|
||||
|
||||
public void load_encrypt(){
|
||||
|
||||
Stage stage = (Stage) splitPane.getScene().getWindow();
|
||||
|
||||
AnchorPane fx = null;
|
||||
try {
|
||||
fx = FXMLLoader.load(ResourcesUtils.getResource("home"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Scene scene = new Scene(fx);
|
||||
stage.setScene(scene);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
init();
|
||||
listView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue != null) {
|
||||
if (newValue.getIndex() == 0 ){
|
||||
video();
|
||||
}
|
||||
if (newValue.getIndex() == 1 ){
|
||||
music();
|
||||
}
|
||||
if (newValue.getIndex() == 2){
|
||||
vip_parser();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void init() {
|
||||
ResourcesUtils.Player[] values = ResourcesUtils.Player.values();
|
||||
ObservableList<ResourcesUtils.Player> list = FXCollections.observableArrayList();
|
||||
list.addAll(Arrays.asList(values));
|
||||
listView.setItems(list);
|
||||
video();
|
||||
}
|
||||
|
||||
private void music(){
|
||||
listView.getSelectionModel().select(1);
|
||||
try {
|
||||
root = FXMLLoader.load(ResourcesUtils.getResource("music"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
common_method();
|
||||
}
|
||||
|
||||
private void vip_parser(){
|
||||
listView.getSelectionModel().select(2);
|
||||
try {
|
||||
root = FXMLLoader.load(ResourcesUtils.getResource("vip-parser"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
common_method();
|
||||
}
|
||||
|
||||
private void common_method(){
|
||||
splitPane.getItems().remove(1);
|
||||
splitPane.getItems().add(1, root);
|
||||
root.widthProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue != null) {
|
||||
double width = splitPane.getWidth();
|
||||
PlayerController.this.width.set(width);
|
||||
}
|
||||
});
|
||||
root.heightProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue != null) {
|
||||
double height = splitPane.getHeight();
|
||||
PlayerController.this.height.set(height);
|
||||
}
|
||||
});
|
||||
|
||||
this.width.addListener((observable, oldValue, newValue) -> {
|
||||
PlayerController.this.root.setPrefWidth(newValue.doubleValue() - listView.getWidth());
|
||||
});
|
||||
|
||||
this.height.addListener((observable, oldValue, newValue) -> {
|
||||
PlayerController.this.root.setPrefHeight(newValue.doubleValue() - listView.getHeight());
|
||||
});
|
||||
}
|
||||
|
||||
private void video(){
|
||||
//默认选择第一个
|
||||
listView.getSelectionModel().select(0);
|
||||
try {
|
||||
root = FXMLLoader.load(ResourcesUtils.getResource("video"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
common_method();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.zhangmeng.tools.controller;
|
||||
|
||||
/**
|
||||
* @author : 芊芊墨客
|
||||
* @version : 1.0
|
||||
* @date : 2023-02-16 11:08
|
||||
*/
|
||||
public class VideoController {
|
||||
}
|
||||
|
|
@ -18,8 +18,8 @@ public class ResourcesUtils {
|
|||
|
||||
public enum Menu{
|
||||
Md5("md5加密",0),
|
||||
SpringSecurity("spring加密",1),
|
||||
VipParser("vip解析",2);
|
||||
SpringSecurity("spring加密",1);
|
||||
|
||||
|
||||
Menu(String title, int index) {
|
||||
this.title = title;
|
||||
|
|
@ -47,5 +47,34 @@ public class ResourcesUtils {
|
|||
|
||||
}
|
||||
|
||||
public enum
|
||||
public enum Player{
|
||||
|
||||
Video("视频播放",0),
|
||||
Music("音乐播放",1),
|
||||
VipParser("vip解析",2);
|
||||
|
||||
Player(String title, int index) {
|
||||
this.title = title;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public void setIndex(int index) {
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
private String title;
|
||||
private int index;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,33 +7,41 @@
|
|||
<?import javafx.scene.control.SplitPane?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1661.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhangmeng.tools.controller.HomeController">
|
||||
<children>
|
||||
<MenuBar layoutX="14.0" layoutY="27.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<menus>
|
||||
<Menu mnemonicParsing="false" text="加密工具">
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0"
|
||||
prefWidth="1661.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.zhangmeng.tools.controller.HomeController">
|
||||
<children>
|
||||
<MenuBar layoutX="14.0" layoutY="27.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||
AnchorPane.topAnchor="0.0">
|
||||
<menus>
|
||||
<Menu mnemonicParsing="false" text="加密工具">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" onAction="#md5_menu_item" text="md5 加密"/>
|
||||
<MenuItem mnemonicParsing="false" onAction="#spring_security_menu_item"
|
||||
text="spring security 加密"/>
|
||||
</items>
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="影音工具">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="视频播放" onAction="#video_menu_item"/>
|
||||
<MenuItem mnemonicParsing="false" text="音乐播放" onAction="#music_menu_item"/>
|
||||
<MenuItem mnemonicParsing="false" text="vip 视频解析" onAction="#vip_parser_menu_item"/>
|
||||
</items>
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="Help">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="About"/>
|
||||
</items>
|
||||
</Menu>
|
||||
</menus>
|
||||
</MenuBar>
|
||||
<SplitPane fx:id="splitPane" dividerPositions="0.5" layoutY="25.0" prefHeight="575.0" prefWidth="1200.0"
|
||||
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||
AnchorPane.topAnchor="25.0">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="md5 加密" onAction="#md5_menu_item" />
|
||||
<MenuItem mnemonicParsing="false" text="spring security 加密" onAction="#spring_security_menu_item"/>
|
||||
<ListView fx:id="listView" maxWidth="300.0" minWidth="200.0" prefHeight="200.0" prefWidth="200.0"/>
|
||||
<AnchorPane prefHeight="200.0" prefWidth="200.0"/>
|
||||
</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>
|
||||
<SplitPane fx:id="splitPane" dividerPositions="0.5" layoutY="25.0" prefHeight="575.0" prefWidth="1200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="25.0">
|
||||
<items>
|
||||
<ListView fx:id="listView" maxWidth="300.0" minWidth="200.0" prefHeight="200.0" prefWidth="200.0" />
|
||||
<AnchorPane prefHeight="200.0" prefWidth="200.0" />
|
||||
</items>
|
||||
</SplitPane>
|
||||
</children>
|
||||
</SplitPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import java.lang.*?>
|
||||
<?import java.util.*?>
|
||||
<?import javafx.scene.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<AnchorPane xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="com.zhangmeng.tools.controller.MusicController"
|
||||
prefHeight="400.0" prefWidth="600.0">
|
||||
|
||||
</AnchorPane>
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.ListView?>
|
||||
<?import javafx.scene.control.Menu?>
|
||||
<?import javafx.scene.control.MenuBar?>
|
||||
<?import javafx.scene.control.MenuItem?>
|
||||
<?import javafx.scene.control.SplitPane?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0"
|
||||
prefWidth="1661.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.zhangmeng.tools.controller.PlayerController">
|
||||
<children>
|
||||
<MenuBar layoutX="14.0" layoutY="27.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||
AnchorPane.topAnchor="0.0">
|
||||
<menus>
|
||||
<Menu mnemonicParsing="false" text="加密工具">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" onAction="#md5_menu_item" text="md5 加密"/>
|
||||
<MenuItem mnemonicParsing="false" onAction="#spring_security_menu_item"
|
||||
text="spring security 加密"/>
|
||||
</items>
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="影音工具">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="视频播放" onAction="#video_menu_item"/>
|
||||
<MenuItem mnemonicParsing="false" text="音乐播放" onAction="#music_menu_item"/>
|
||||
<MenuItem mnemonicParsing="false" text="vip 视频解析" onAction="#vip_parser_menu_item"/>
|
||||
</items>
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="Help">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="About"/>
|
||||
</items>
|
||||
</Menu>
|
||||
</menus>
|
||||
</MenuBar>
|
||||
<SplitPane fx:id="splitPane" dividerPositions="0.5" layoutY="25.0" prefHeight="575.0" prefWidth="1200.0"
|
||||
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||
AnchorPane.topAnchor="25.0">
|
||||
<items>
|
||||
<ListView id="listView" fx:id="listView" maxWidth="300.0" minWidth="200.0" prefHeight="200.0" prefWidth="200.0"/>
|
||||
<AnchorPane prefHeight="200.0" prefWidth="200.0"/>
|
||||
</items>
|
||||
</SplitPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import java.lang.*?>
|
||||
<?import java.util.*?>
|
||||
<?import javafx.scene.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<AnchorPane xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="com.zhangmeng.tools.controller.VideoController"
|
||||
prefHeight="400.0" prefWidth="600.0">
|
||||
|
||||
</AnchorPane>
|
||||
Loading…
Reference in New Issue