自定义标签 2023年4月24日18:00:58
parent
9e8ebb3542
commit
2b4a40e567
|
|
@ -0,0 +1,64 @@
|
|||
package com.zhangmeng.tools.utils;
|
||||
|
||||
import cn.hutool.core.io.resource.ClassPathResource;
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.util.XmlUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.zhangmeng.tools.builder.MusicPlayerBuilderFactory;
|
||||
import com.zhangmeng.tools.music.musicPlayer.MusicPlayer;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.util.BuilderFactory;
|
||||
import jdk.dynalink.linker.LinkerServices;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : 芊芊墨客
|
||||
* @version : 1.0
|
||||
* @date : 2023-04-24 14:19
|
||||
*/
|
||||
public class FxmlUtils {
|
||||
|
||||
public static void main(String[] args) {
|
||||
write_xml();
|
||||
}
|
||||
|
||||
public static void read_fxml(){
|
||||
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader();
|
||||
URL url = fxmlLoader.getClassLoader().getResource("config/music-list.fxml");
|
||||
fxmlLoader.setLocation(url);
|
||||
fxmlLoader.setBuilderFactory(new MusicPlayerBuilderFactory());
|
||||
|
||||
ArrayList<MusicPlayer> load = fxmlLoader.load();
|
||||
for (MusicPlayer musicPlayer : load) {
|
||||
System.out.println(musicPlayer.getFile_path() + " - " + musicPlayer.getFile_lyric());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void write_xml(){
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader();
|
||||
URL url = fxmlLoader.getClassLoader().getResource("config/music-list.fxml");
|
||||
fxmlLoader.setLocation(url);
|
||||
fxmlLoader.setBuilderFactory(new MusicPlayerBuilderFactory());
|
||||
|
||||
ArrayList<MusicPlayer> load = fxmlLoader.load();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import com.zhangmeng.tools.music.musicPlayer.MusicPlayer?>
|
||||
<?import java.util.ArrayList?>
|
||||
|
||||
<ArrayList>
|
||||
<MusicPlayer file_path="a" file_lyric="18" singer="1"/>
|
||||
<MusicPlayer file_path="b" file_lyric="18" singer="1"/>
|
||||
<MusicPlayer file_path="b" file_lyric="18" singer="1"/>
|
||||
<MusicPlayer file_path="d" file_lyric="18" singer="1"/>
|
||||
<MusicPlayer file_path="e" file_lyric="18" singer="1"/>
|
||||
<MusicPlayer file_path="f" file_lyric="18" singer="1"/>
|
||||
<MusicPlayer file_path="g" file_lyric="18" singer="1"/>
|
||||
<MusicPlayer file_path="h" file_lyric="18" singer="1"/>
|
||||
<MusicPlayer file_path="i" file_lyric="18" singer="1"/>
|
||||
<MusicPlayer file_path="j" file_lyric="18" singer="1"/>
|
||||
<MusicPlayer file_path="k" file_lyric="18" singer="1"/>
|
||||
<MusicPlayer file_path="l" file_lyric="18" singer="1"/>
|
||||
<MusicPlayer file_path="m" file_lyric="18" singer="1"/>
|
||||
<MusicPlayer file_path="n" file_lyric="18" singer="1"/>
|
||||
|
||||
</ArrayList>
|
||||
Loading…
Reference in New Issue