Skip to content

Commit 79973fa

Browse files
Tom BrouwsTom Brouws
Tom Brouws
authored and
Tom Brouws
committed
Merge pull request #114 from ProgrammingLife3/fix/iconResolutions
Extra icon resolutions
2 parents d5be09e + 9537afa commit 79973fa

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/main/java/tudelft/ti2806/pl3/Application.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import java.io.FileNotFoundException;
3333
import java.io.IOException;
3434
import java.util.ArrayList;
35-
import javax.swing.ImageIcon;
3635
import javax.swing.JFrame;
3736
import javax.swing.JLayeredPane;
3837
import javax.swing.JMenuBar;
@@ -56,7 +55,6 @@ public class Application extends JFrame implements ControllerContainer {
5655

5756
private ScreenSize size;
5857

59-
6058
/**
6159
* The controllers of the application.
6260
*/
@@ -71,8 +69,7 @@ public class Application extends JFrame implements ControllerContainer {
7169
*/
7270
public Application() {
7371
super(Constants.APP_NAME);
74-
75-
this.setIconImage(new ImageIcon(Resources.getResource("pictures/helix64.png")).getImage());
72+
this.setIconImages(Resources.getIcons());
7673
// read the last opened files
7774
try {
7875
LastOpenedStack<File> files = ParserLastOpened.readLastOpened();

src/main/java/tudelft/ti2806/pl3/util/Resources.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
package tudelft.ti2806.pl3.util;
22

3+
import java.awt.Image;
34
import java.io.InputStream;
45
import java.net.URL;
6+
import java.util.Arrays;
7+
import java.util.List;
8+
import java.util.stream.Collectors;
9+
import javax.swing.ImageIcon;
510

611
/**
712
* Created by Mathieu Post on 5-6-15.
@@ -14,4 +19,10 @@ public static URL getResource(String file) {
1419
public static InputStream getResourceAsStream(String file) {
1520
return Resources.class.getClassLoader().getResourceAsStream(file);
1621
}
22+
23+
public static List<Image> getIcons() {
24+
List<Integer> list = Arrays.asList(16, 20, 24, 32, 48, 64, 128, 256, 512);
25+
return list.stream().map(integer -> new ImageIcon(getResource("pictures/helix" + integer + ".png")).getImage())
26+
.collect(Collectors.toList());
27+
}
1728
}

0 commit comments

Comments
 (0)