Skip to content

Commit

Permalink
Added application icon to work on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Hein committed Mar 11, 2018
1 parent 2bb2519 commit 50f57e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ ehthumbs.db
Thumbs.db
\.idea/
out/

META-INF/
5 changes: 5 additions & 0 deletions PPICalculator.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@
import javafx.scene.layout.Pane;
import javafx.stage.Stage;

import javax.swing.*;

public class PPICalculator extends Application {

@Override
public void start(Stage primaryStage) throws Exception {
try {
com.apple.eawt.Application.getApplication().setDockIconImage(new ImageIcon("ppi.jpg").getImage());
Pane root = FXMLLoader.load(getClass().getClassLoader().getResource("ppi.fxml"));
Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.setTitle("PPI Calculator");
primaryStage.getIcons().add(new Image("file:ppi.jpg"));
primaryStage.getIcons().add(new Image(PPICalculator.class.getResourceAsStream("ppi.jpg")));
primaryStage.resizableProperty().set(false);
primaryStage.show();
} catch (IOException e) {
Expand All @@ -30,3 +34,4 @@ public static void main(String[] args) {
}

}

0 comments on commit 50f57e3

Please sign in to comment.