dimanche 10 mai 2015

How would you change your programs Icon instead of the default java icon

This shows the icon when I launch through eclipse, but when I export it to a Runnable Jar It shows the default Java icon, I do not want to use the Resource way of doing it since it doesn't work in the IDE even.

public static void main(String args[]) {
    Game component = new Game();
    ImageIcon img = new ImageIcon("res/game.png");

    JFrame frame = new JFrame();
    frame.add(component);
    frame.setTitle(NAME);
    frame.setIconImage(img.getImage());
    frame.setResizable(false);
    frame.setLocationRelativeTo(null);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setVisible(true);

    component.start();
}

Aucun commentaire:

Enregistrer un commentaire