完善 2023年2月17日16:14:28
parent
014e3eeaa2
commit
ae0f4779e3
|
|
@ -1,5 +1,6 @@
|
|||
package com.zhangmeng.tools.controller;
|
||||
|
||||
import com.zhangmeng.tools.utils.ImagePath;
|
||||
import com.zhangmeng.tools.utils.ResourcesUtils;
|
||||
import javafx.beans.property.SimpleDoubleProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
|
|
@ -9,12 +10,19 @@ import javafx.collections.FXCollections;
|
|||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.paint.Paint;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.util.Callback;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
@ -33,6 +41,8 @@ public class HomeController implements Serializable {
|
|||
private SimpleDoubleProperty height = new SimpleDoubleProperty(0.0);
|
||||
private AnchorPane root;
|
||||
|
||||
public static final String color_cell = "#f4f4f4";
|
||||
|
||||
@FXML
|
||||
private ListView<ResourcesUtils.Menu> listView;
|
||||
|
||||
|
|
@ -95,11 +105,64 @@ public class HomeController implements Serializable {
|
|||
});
|
||||
}
|
||||
|
||||
public static Image getImage(ResourcesUtils.Menu player){
|
||||
return switch (player){
|
||||
case Md5 -> new Image(ImagePath.path(ImagePath.ImagePathType.MD5));
|
||||
case SpringSecurity -> new Image(ImagePath.path(ImagePath.ImagePathType.SPRING_SECURITY));
|
||||
};
|
||||
}
|
||||
|
||||
public void init() {
|
||||
ResourcesUtils.Menu[] values = ResourcesUtils.Menu.values();
|
||||
ObservableList<ResourcesUtils.Menu> list = FXCollections.observableArrayList();
|
||||
list.addAll(Arrays.asList(values));
|
||||
listView.setItems(list);
|
||||
listView.setFixedCellSize(40);
|
||||
listView.setCellFactory(new Callback<>() {
|
||||
private int position;
|
||||
@Override
|
||||
public ListCell<ResourcesUtils.Menu> call(ListView<ResourcesUtils.Menu> playerListView) {
|
||||
Label label = new Label();
|
||||
label.setPrefWidth(100);
|
||||
ListCell<ResourcesUtils.Menu> listCell = new ListCell<>() {
|
||||
@Override
|
||||
protected void updateItem(ResourcesUtils.Menu player, boolean b) {
|
||||
super.updateItem(player, b);
|
||||
if (!b) {
|
||||
HBox hBox = new HBox(25);
|
||||
hBox.setAlignment(Pos.CENTER);
|
||||
label.setText(player.getTitle());
|
||||
label.setTextFill(Paint.valueOf("#000000"));
|
||||
Image im = getImage(player);
|
||||
ImageView iv = new ImageView(im);
|
||||
iv.setPreserveRatio(true);
|
||||
iv.setFitWidth(15);
|
||||
hBox.getChildren().add(iv);
|
||||
|
||||
hBox.getChildren().add(label);
|
||||
this.setGraphic(hBox);
|
||||
}
|
||||
this.setStyle("-fx-background-color: " + color_cell);
|
||||
}
|
||||
};
|
||||
|
||||
listCell.hoverProperty().addListener((observableValue, aBoolean, t1) -> {
|
||||
if (t1 && !label.getText().equals("")) {
|
||||
position = playerListView.getItems().indexOf(label.getText());
|
||||
label.setFont(new Font(16));
|
||||
playerListView.getFocusModel().focus(position);
|
||||
listCell.setStyle("-fx-background-color: #f6edc3");
|
||||
} else {
|
||||
label.setPrefHeight(20);
|
||||
label.setFont(new Font(13));
|
||||
listCell.setStyle("-fx-background-color: " + color_cell);
|
||||
}
|
||||
});
|
||||
|
||||
return listCell;
|
||||
}
|
||||
});
|
||||
|
||||
md5();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -592,13 +592,13 @@ public class MusicController {
|
|||
if (newValue.intValue() == cell.getIndex()) {
|
||||
if (cell.getGraphic() != null) {
|
||||
text = (Text)cell.getGraphic();
|
||||
text.setFont(Font.font(19.0D));
|
||||
text.setFont(Font.font(16.0D));
|
||||
text.setFill(Color.DEEPSKYBLUE);
|
||||
}
|
||||
} else if (cell.getGraphic() != null) {
|
||||
text = (Text)cell.getGraphic();
|
||||
text.setFont(Font.font(16.0D));
|
||||
text.setFill(Color.WHITE);
|
||||
text.setFont(Font.font(13.0D));
|
||||
text.setFill(Color.BLACK);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,32 @@
|
|||
package com.zhangmeng.tools.controller;
|
||||
|
||||
import com.zhangmeng.tools.utils.ImagePath;
|
||||
import com.zhangmeng.tools.utils.ResourcesUtils;
|
||||
import javafx.beans.property.SimpleDoubleProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ListCell;
|
||||
import javafx.scene.control.ListView;
|
||||
import javafx.scene.control.SplitPane;
|
||||
import javafx.scene.control.cell.TextFieldListCell;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.paint.Paint;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.util.Callback;
|
||||
import javafx.util.StringConverter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
@ -35,6 +50,8 @@ public class PlayerController {
|
|||
@FXML
|
||||
private SplitPane splitPane;
|
||||
|
||||
public static final String color_cell = "#f4f4f4";
|
||||
|
||||
@FXML
|
||||
public void md5_menu_item() {
|
||||
load_encrypt();
|
||||
|
|
@ -92,12 +109,69 @@ public class PlayerController {
|
|||
});
|
||||
}
|
||||
|
||||
public static Image getImage(ResourcesUtils.Player player){
|
||||
return switch (player){
|
||||
case Video -> new Image(ImagePath.path(ImagePath.ImagePathType.VIDEO_PLAYER));
|
||||
case Music -> new Image(ImagePath.path(ImagePath.ImagePathType.MUSIC_PLAYER));
|
||||
case VipParser -> new Image(ImagePath.path(ImagePath.ImagePathType.VIP_PLAYER));
|
||||
};
|
||||
}
|
||||
|
||||
public void init() {
|
||||
ResourcesUtils.Player[] values = ResourcesUtils.Player.values();
|
||||
ObservableList<ResourcesUtils.Player> list = FXCollections.observableArrayList();
|
||||
list.addAll(Arrays.asList(values));
|
||||
listView.setItems(list);
|
||||
listView.setFixedCellSize(40);
|
||||
listView.setCellFactory(new Callback<>() {
|
||||
|
||||
private int position;
|
||||
|
||||
@Override
|
||||
public ListCell<ResourcesUtils.Player> call(ListView<ResourcesUtils.Player> playerListView) {
|
||||
|
||||
Label label = new Label();
|
||||
label.setPrefWidth(100);
|
||||
ListCell<ResourcesUtils.Player> listCell = new ListCell<>() {
|
||||
@Override
|
||||
protected void updateItem(ResourcesUtils.Player player, boolean b) {
|
||||
super.updateItem(player, b);
|
||||
if (!b) {
|
||||
HBox hBox = new HBox(30);
|
||||
hBox.setAlignment(Pos.CENTER);
|
||||
label.setText(player.getTitle());
|
||||
label.setTextFill(Paint.valueOf("#000000"));
|
||||
Image im = getImage(player);
|
||||
ImageView iv = new ImageView(im);
|
||||
iv.setPreserveRatio(true);
|
||||
iv.setFitWidth(15);
|
||||
hBox.getChildren().add(iv);
|
||||
hBox.getChildren().add(label);
|
||||
this.setGraphic(hBox);
|
||||
}
|
||||
this.setStyle("-fx-background-color: " + color_cell);
|
||||
}
|
||||
};
|
||||
|
||||
listCell.hoverProperty().addListener(new ChangeListener<Boolean>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends Boolean> observableValue, Boolean aBoolean, Boolean t1) {
|
||||
if (t1 && !label.getText().equals("")) {
|
||||
position = playerListView.getItems().indexOf(label.getText());
|
||||
label.setFont(new Font(16));
|
||||
playerListView.getFocusModel().focus(position);
|
||||
listCell.setStyle("-fx-background-color: #f6edc3");
|
||||
}else {
|
||||
label.setPrefHeight(20);
|
||||
label.setFont(new Font(13));
|
||||
listCell.setStyle("-fx-background-color: " + color_cell);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return listCell;
|
||||
}
|
||||
});
|
||||
video();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,12 @@ public class ImagePath {
|
|||
|
||||
IMAGE_FILE("文件图标"),
|
||||
|
||||
VIDEO_PLAYER("视频播放"),
|
||||
MUSIC_PLAYER("音乐播放"),
|
||||
VIP_PLAYER("VIP解析播放"),
|
||||
MD5("md5 加密"),
|
||||
SPRING_SECURITY("SPRING_SECURITY 加密"),
|
||||
|
||||
ICON_NULL_COVER("");
|
||||
|
||||
private String desc;
|
||||
|
|
@ -222,6 +228,12 @@ public class ImagePath {
|
|||
|
||||
public static String SVG_FILE = "svg/file.png";
|
||||
|
||||
public static String VIP_PLAYER = "svg/vip-player.png";
|
||||
public static String VIDEO_PLAYER = "svg/video-player.png";
|
||||
public static String MUSIC_PLAYER = "svg/music-player.png";
|
||||
public static String MD5 = "svg/md5.png";
|
||||
public static String SPRING_SECURITY = "svg/spring-security.png";
|
||||
|
||||
public static String path(ImagePathType type) {
|
||||
|
||||
String path = null;
|
||||
|
|
@ -348,6 +360,21 @@ public class ImagePath {
|
|||
case IMAGE_FILE:
|
||||
path = ImagePath.SVG_FILE;
|
||||
break;
|
||||
case VIDEO_PLAYER:
|
||||
path = ImagePath.VIDEO_PLAYER;
|
||||
break;
|
||||
case MUSIC_PLAYER:
|
||||
path = ImagePath.MUSIC_PLAYER;
|
||||
break;
|
||||
case VIP_PLAYER:
|
||||
path = ImagePath.VIP_PLAYER;
|
||||
break;
|
||||
case MD5:
|
||||
path = ImagePath.MD5;
|
||||
break;
|
||||
case SPRING_SECURITY:
|
||||
path = ImagePath.SPRING_SECURITY;
|
||||
break;
|
||||
}
|
||||
return "static/" + path;
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.5 KiB |
Loading…
Reference in New Issue