added error handling to remote resource in Display

This commit is contained in:
Kjistóf 2016-05-15 23:20:53 +02:00
parent 2f8c4b7168
commit 72387080e1

View File

@ -10,7 +10,8 @@ import java.util.List;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.swing.JPanel;
import javax.swing.*;
public class Display extends JPanel{
private List<Drawer> visuals;
@ -40,13 +41,17 @@ public class Display extends JPanel{
clip.loop(Clip.LOOP_CONTINUOUSLY);
}
catch(Exception e) {
e.printStackTrace(System.out);
JOptionPane.showMessageDialog(null, "Sajnos nem sikerült letölteni a cicazenét! :(");
}
}
public void stopMusic() {
try {
clip.stop();
}
catch (NullPointerException e)
{}
}
@Override
protected void paintComponent(Graphics g) {