📄 genbiblio.java
字号:
package douwe;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.io.File;
import java.util.ArrayList;
import javax.swing.*;
/**
* Cette Classe permet la g閚閞ation graphiquement la biblioth鑡ue
* @author Jimmy & Yasmin
*
*/
public class genBiblio extends JButton{
/**
*
*/
private static final long serialVersionUID = 1L;
private JLabel lblAlbum;
private JLabel artiste;
private JLabel titre;
PlayList pl1;
ArrayList<chanson> L;
/**
* G閚閞ation automatique de la biblioth鑡ue
* @param arg_artiste Nom de l'artiste
* @param arg_titre Titre de l'album
* @param PL Objet Playlist auquel on ajouterait 関entuellement la liste des chansons de l'album
* @param l Liste des chansons de l'album
* @param n Note de l'album
*/
public genBiblio(String arg_artiste,String arg_titre,PlayList PL,ArrayList<chanson> l,int n){
lblAlbum= new JLabel("");
L=l;
pl1=PL;
lblAlbum.setIcon(new ImageIcon("icons/album.jpg"));
artiste = new JLabel(arg_artiste);
titre = new JLabel(arg_titre);
lblAlbum.setOpaque(false);
setLayout(new BorderLayout());
JPanel panelImg = new JPanel();
JPanel panelInfo = new JPanel();
panelImg.setOpaque(false);
panelImg.add(lblAlbum);
panelInfo.setLayout(new BorderLayout());
panelInfo.setOpaque(false);
JPanel etoiles = new JPanel();
etoiles.setLayout(new FlowLayout());
ImageIcon lblIcon=new ImageIcon("icons/star.png");
JLabel lbl_et1= new JLabel(""); JLabel lbl_et2= new JLabel(""); JLabel lbl_et3= new JLabel("");
JLabel lbl_et4= new JLabel(""); JLabel lbl_et5= new JLabel("");
lbl_et1.setIcon(lblIcon);lbl_et2.setIcon(lblIcon);lbl_et3.setIcon(lblIcon);
lbl_et4.setIcon(lblIcon);lbl_et5.setIcon(lblIcon);
lbl_et1.setVisible(false); lbl_et2.setVisible(false); lbl_et3.setVisible(false);
lbl_et4.setVisible(false); lbl_et5.setVisible(false);
etoiles.add(lbl_et1); etoiles.add(lbl_et2); etoiles.add(lbl_et3);
etoiles.add(lbl_et4); etoiles.add(lbl_et5);
if(n>0)lbl_et1.setVisible(true);if(n>1)lbl_et2.setVisible(true);
if(n>2)lbl_et3.setVisible(true);if(n>3)lbl_et4.setVisible(true);
if(n>4)lbl_et5.setVisible(true);
panelInfo.add(artiste,BorderLayout.NORTH);
panelInfo.add(titre, BorderLayout.CENTER);
panelInfo.add(etoiles, BorderLayout.SOUTH);
setLayout(new BorderLayout());
add(panelImg,BorderLayout.WEST);
add(panelInfo,BorderLayout.EAST);
setToolTipText(artiste.getText());
setContentAreaFilled(false);
addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btActionPerformed(evt);
}
});
}
/**
* Evenement clic controler
* @param evt Action Event
*/
private void btActionPerformed(java.awt.event.ActionEvent evt) {
if(JOptionPane.showConfirmDialog(null,"Voulez vous ajouter les chansons de l'album
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -