Skip to content

Commit

Permalink
添加红喇叭效果,改善红框选中效果
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Yao authored and Tony Yao committed May 9, 2017
1 parent 9e650ad commit e6ad365
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 4 deletions.
68 changes: 66 additions & 2 deletions src/com/example/css/left/LeftMusicPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
-fx-border-color: #bfbfbf;
}

//以下是歌单按钮的三种状态的各自样式

.listButton{
-fx-text-fill: #bfbfbf;
-fx-font-size: 20;
Expand All @@ -56,14 +58,53 @@
.listButton:pressed, .listButton:focused{
-fx-text-fill: white;
-fx-background-color: #525252;
}

.listButton:hover{
-fx-text-fill: white;
-fx-effect: dropshadow(three-pass-box , -fx-shadow-highlight-color, 5, 0.0 , 0, 0);
}

.listButtonPlay{
-fx-text-fill: #bfbfbf;
-fx-font-size: 20;
-fx-pref-width:290;
-fx-pref-height:50;
-fx-padding: 5 0 5 15;
-fx-background-image: url(hornBG.png);
}
.listButtonPlay:pressed, .listButtonPlay:focused{
-fx-text-fill: white;
-fx-background-color: #525252;
}

.listButtonPlay:hover{
-fx-text-fill: white;
-fx-effect: dropshadow(three-pass-box , -fx-shadow-highlight-color, 5, 0.0 , 0, 0);
}

.listButtonPlayAndSelected{
-fx-background-image: url(hornBG.png);
-fx-font-size: 20;
-fx-pref-width:290;
-fx-pref-height:50;
-fx-text-fill: white;
-fx-background-color: #525252;
-fx-border-width:0 0 0 7;
-fx-border-color: linear-gradient( #800000 0%, red 100%);
-fx-padding: 5 0 5 8;
}

.listButton:hover{
.listButtonSelected{
-fx-background-image: null;
-fx-font-size: 20;
-fx-pref-width:290;
-fx-pref-height:50;
-fx-text-fill: white;
-fx-effect: dropshadow(three-pass-box , -fx-shadow-highlight-color, 5, 0.0 , 0, 0);
-fx-background-color: #525252;
-fx-border-width:0 0 0 7;
-fx-border-color: linear-gradient( #800000 0%, red 100%);
-fx-padding: 5 0 5 8;
}

.CloseList{
Expand Down Expand Up @@ -103,6 +144,8 @@
-fx-text-fill: white;
}



.lightButton{
-fx-text-fill: #bfbfbf;
-fx-background-color: #1b1d20;
Expand All @@ -120,4 +163,25 @@
.lightButton:focused{
-fx-text-fill: white;
-fx-background-color: #42444a;
}


.localButtonHorn{
-fx-text-fill: #bfbfbf;
-fx-background-color: #1b1d20;
-fx-border-color:#bfbfbf;
-fx-background-image: url("localHorn.png");
}
.localButtonHorn:hover{
-fx-text-fill: white;
-fx-background-color: #42444a;
-fx-effect: dropshadow(three-pass-box , -fx-shadow-highlight-color, 5, 0.0 , 0, 0);
}
.localButtonHorn:pressed{
-fx-text-fill: white;
-fx-background-color: #42444a;
}
.localButtonHorn:focused{
-fx-text-fill: white;
-fx-background-color: #42444a;
}
Binary file added src/com/example/css/left/hornBG.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/com/example/css/left/localHorn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 37 additions & 2 deletions src/com/example/event/MainAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,27 @@ private void loopDirectory(File file, ArrayList<File> fl) {
}

public void createMusicList(Button nb) {
nb.getStyleClass().remove(0);
nb.getStyleClass().add("listButton");
nb.getStyleClass().set(0,"listButton");
ml.getItems().add(nb);
nb.setOnAction(nbe -> {
musiclist(nb.getText());

for(Button m : ml.getItems()){
if(m.getStyleClass().get(0).equals("listButtonPlayAndSelected")){
m.getStyleClass().set(0, "listButtonPlay");
}
else if(m.getStyleClass().get(0).equals("listButtonPlay")){
continue;
}
else{
m.getStyleClass().set(0, "listButton");
}
}
if(nb.getStyleClass().get(0).equals("listButtonPlay")){
nb.getStyleClass().set(0,"listButtonPlayAndSelected");
}else{
nb.getStyleClass().set(0,"listButtonSelected");
}
});
nb.setOnMouseClicked(tca);
}
Expand Down Expand Up @@ -767,4 +783,23 @@ public static MainAction getMa() {
ma = new MainAction(GUI.getGui());
return ma;
}

public static void changeHorn(String musicListName) {//给播放歌单添加小喇叭
Button btn = gui.getLlC().getButton_localMusic();
if(musicListName.equals("本地音乐")){
btn.getStyleClass().set(0, "localButtonHorn");
for(Button m : ml.getItems()){
m.getStyleClass().set(0, "listButton");
}
}else{
btn.getStyleClass().set(0, "lightButton");
for(Button m : ml.getItems()){
m.getStyleClass().set(0, "listButton");
if(m.getText().equals(musicListName)){
m.getStyleClass().set(0, "listButtonPlayAndSelected");
}
}
}
}

}
1 change: 1 addition & 0 deletions src/com/example/event/TagClickAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ public ContextBox(TagClickAction action) {
MainAction.ps.setCurrent_song(ml.get(mli));
MainAction.setCurrentList(l);
MainAction.pause();
MainAction.changeHorn(GlobalVariable.currentMenu.get());
});
play_next.setOnAction(e ->{
List<MusicUtils> cl = MainAction.ps.getCurrent_songMenu();
Expand Down

0 comments on commit e6ad365

Please sign in to comment.