自定义标签 2023年4月24日18:00:58
parent
289acf3636
commit
8a47040eb2
|
|
@ -53,8 +53,7 @@ import javafx.scene.Scene;
|
|||
import javafx.scene.control.*;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.MouseButton;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.input.*;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.scene.media.AudioSpectrumListener;
|
||||
import javafx.scene.media.Media;
|
||||
|
|
@ -563,22 +562,23 @@ public class MusicController {
|
|||
listView.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, null, null)));
|
||||
listView.setFixedCellSize(40.0D);
|
||||
list_cell();
|
||||
MenuItem mi1 = new MenuItem("搜索");
|
||||
mi1.setOnAction(new EventHandler<ActionEvent>() {
|
||||
public void handle(ActionEvent event) {
|
||||
Stage primaryStage = (Stage) MusicController.this.listView.getScene().getWindow();
|
||||
|
||||
AnchorPane root = null;
|
||||
try {
|
||||
root = FXMLLoader.load(ResourcesUtils.getResource("music-search"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//第四种 -用的最多 在win和 mackintosh 都适用
|
||||
// KeyCombination kccb = new KeyCodeCombination(KeyCode.F, KeyCombination.SHORTCUT_DOWN);
|
||||
// listView.getScene().getAccelerators().put(kccb, new Runnable() {//其实还是当前线程执行
|
||||
// @Override
|
||||
// public void run() {
|
||||
// AnchorPane root = null;
|
||||
// try {
|
||||
// root = FXMLLoader.load(ResourcesUtils.getResource("music-search"));
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// Stage primaryStage = (Stage) MusicController.this.listView.getScene().getWindow();
|
||||
// AlertUtils.alert("搜索", root, primaryStage);
|
||||
// }
|
||||
// });
|
||||
|
||||
AlertUtils.alert("设置", root, primaryStage);
|
||||
}
|
||||
});
|
||||
ContextMenu cm = new ContextMenu(mi1);
|
||||
}
|
||||
|
||||
private void list_cell() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue