四川科技职业学院毕业设计(论文)
第 28 页
图:5.2.5
/**
* 加载指定歌词背景的属性 * @param file是属性文件 */
private void loadProperties(String path) { try {
pp.load(FileUtils.getInputStream(path));// 读取属性文件 } catch (FileNotFoundException e) { System.out.println(\ } catch (IOException e) {
System.out.println(\ } }
/**
* 设置歌词背景的属性 * @param i 是属性的下标 */
public void setProperties(int i) {
四川科技职业学院毕业设计(论文)
第 29 页
if (i >= 0 && i < ComVariable.TOTAL_LRC_PROPERTIES) { String path = \ loadProperties(path);
Config.getInstance().setLrcbg(i); } }
/**
* 得到前景色 * @return 前景色 */
public Color getForegroundColor() {
String decode = pp.getProperty(\ if (decode == null) {
return new Color(0, 255, 0); }
return Color.decode(decode); } /**
* 得到背景色 * @return 背景色 */
public Color getBackgroundColor() {
String decode = pp.getProperty(\
return Color.decode(decode); }
/**
四川科技职业学院毕业设计(论文)
第 30 页
* 得到背景图片Image
* @return 背景图片 */
public Image getBackgroundImage() {
String imgPath = pp.getProperty(\ return new IconTool(imgPath).getImage(); }
public static LRCProperties getInstance() { return lrcp; } /**
* 设置歌词背景
* @param index为歌词背景的下标 */
public void setLRCBackImage(int index) {
if (index < 0 || index >= bgImageMenuItem.length || index == bgImageNum) {
return; }
bgImageMenuItem[index].setIcon(new IconTool(\
if (bgImageNum != -1) {
bgImageMenuItem[bgImageNum].setIcon(null);
}
lrcp.setProperties(index); lrcLabel.repaint(); bgImageNum = index;
}
四川科技职业学院毕业设计(论文)
第 31 页
5.3 皮肤功能详细设计
此功能主要采用对话框形式显示皮肤缩略图,然后根据自己喜好选择设置皮肤,也可以点击下面的更换颜色选择器自己配色。如图5.3
图5.3
主要功能实现代码: /** * 皮肤类 * @author jys1109 */
public class MySkin {
private static MySkin mySkin = new MySkin(); private Config config = Config.getInstance(); private Properties pp = new Properties(); private int themeNumer = config.getTheme();
private MySkin() {
setTheme(config.getTheme());
四川科技职业学院毕业设计(论文)
第 32 页
}
/**
* 加载主题 * @param path */
private void loadTheme(String path) {
try {
pp.load(FileUtils.getInputStream(path));// 读取属性文件 } catch (FileNotFoundException e) { System.out.println(\ } catch (IOException e) {
System.out.println(\ } }
/**
* 设置主题 * @param i */
public void setTheme(int i) {
String path = \ loadTheme(path);
config.setTheme(i);
this.themeNumer = i; refreshSystem(); } /**
* 系统UI进行更新
*/