package plugins.audioPlayer;
import java.awt.GridLayout;
import java.io.File;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import plugins.audioPlayer.javazoom.jlgui.player.amp.StandalonePlayer;
import annotation.Menu;
import interfaces.PluginInterface;
public class AudioPlayer implements PluginInterface{
boolean parDefaut =true;
@Menu(libelle="AudioPlayer")
@Override
public JPanel getFrameDetail() {
JPanel p = new JPanel();
p.setLayout(new GridLayout(10, 3));
p.add(new JLabel("Details : Audio Player"));
p.add(new JLabel("Version : "+getVersion()));
StringBuilder extension = new StringBuilder("");
for(String e : getExtension())
extension.append(" | "+e);
p.add(new JLabel("Extension : "+extension));
if(isDefault())
p.add(new JLabel("par défaut : Oui"));
return p;
}
@Override
public String[] getExtension() {
return new String[]{"mp3","wav"};
}
@Override
public String getVersion() {
return "1.0";
}
@Override
public JFrame getFrame(File o) {
final StandalonePlayer player = new StandalonePlayer();
player.parseParameters(new String[]{"-song",o.getAbsolutePath(),"-start"});
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
player.loadUI();
player.loadJS();
player.loadPlaylist();
player.boot();
}
});
return player;
}
@Override
public boolean isDefault() {
return parDefaut;
}
@Override
public void setDefault(boolean bool) {
parDefaut = bool;
}
@Override
public ImageIcon getIcon() {
return new ImageIcon("../Plugin/bin/plugins/audioPlayer/AudioPlayer.png");
}
}