Commit 387143cd authored by ludwig's avatar ludwig

fixed broken icon paths

git-svn-id: https://www2.in.tum.de/repos/ttt/trunk@85 0463f305-d864-43cb-8a47-61cf597d4139
parent 451da1a5
......@@ -531,26 +531,30 @@ public class Constants {
return null;
}
}
//Creates and returns an Image Icon
/**
* Creates and returns an Image Icon
*
* @param iconName just the File name of the Image
* @return The corresponding ImageIcon
*/
public static ImageIcon getIcon(String iconName) {
String iconPath = TTT.class.getResource("Constants.class").toString().replaceFirst("ttt/Constants.class", "resources/");
ImageIcon icon = new ImageIcon();
URL x;
String iconPath = TTT.class.getResource("Constants.class").toString()
.replaceFirst("ttt/Constants.class", "resources/");
try {
x = new URL(iconPath + iconName);
icon = new ImageIcon(x);
}
catch(NullPointerException e){
System.out.println("Couldn't find Icon Path: " + iconPath + iconName);
icon = new ImageIcon();
} catch (MalformedURLException e) {
System.out.println("Couldn't find Icon Path: " + iconPath + iconName);
icon = new ImageIcon();
}
return icon;
File e = new File(new URL(iconPath + iconName).getPath());
if (e.exists()) {
return new ImageIcon(e.getCanonicalPath());
} else {
System.out
.println("Couldn't find Icon: " + iconPath + iconName);
}
} catch (IOException e) {
System.out
.println("Couldn't find Icon: " + iconPath + iconName);
e.printStackTrace();
}
return null;
}
}
......@@ -130,8 +130,8 @@ public class Recorder implements MessageConsumer, Closeable {
final String STOP = "stop";
final String PLAY = "play";
final Icon record_icon = Constants.getIcon("Record24.gif");
final Icon stop_icon =Constants.getIcon("esources/Stop24.gif");
final Icon record_icon = Constants.getIcon("Record24.png");
final Icon stop_icon =Constants.getIcon("Stop24.gif");
final JButton recordButton = new RollOverButton(record_icon, RECORD);
final JButton playButton = new RollOverButton(Constants.getIcon("Play24.gif"), PLAY);
......@@ -300,7 +300,7 @@ public class Recorder implements MessageConsumer, Closeable {
final String RECORD = "record";
final String STOP = "stop";
final Icon record_icon = Constants.getIcon("Record24.gif");
final Icon record_icon = Constants.getIcon("Record24.png");
final Icon stop_icon = Constants.getIcon("Stop24.gif");
final JButton recordButton = new RollOverButton(record_icon, RECORD);
......
......@@ -1467,7 +1467,7 @@ public class TTT extends JFrame {
"but can be dragged to any other position on screen."));
infoPanel.add(new JLabel(" "));
infoPanel.add(new JLabel("record", Constants
.getIcon("Record24.gif"), JLabel.LEFT));
.getIcon("Record24.png"), JLabel.LEFT));
infoPanel.add(new JLabel("stop recording", Constants
.getIcon("Stop24.gif"), JLabel.LEFT));
infoPanel.add(new JLabel("display TTT main window",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment