Boa noite, estou fazendo um jogo no Eclipse e estou trabalhando na parte da janela, e gostaria de saber como mudar aquele ícone padrão do java na janela:
Aqui o meu código:
public static JFrame frame;
private Thread thread;
private boolean isRunning = true;
private final int width = 160;
private final int height = 120;
private final int scale = 4;
public Game() {
setPreferredSize(new Dimension(width*scale, height*scale));
initFrame();
}
public void initFrame() {
//Window
frame = new JFrame("Undertale Ping Pong");
frame.add(this);
frame.setResizable(false);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
public synchronized void start() {
thread = new Thread(this);
isRunning = true;
thread.start();
}
public synchronized void stop() {
}
public static void main(String args[]) {
Game game = new Game();
game.start();
}
public void tick() {
}
public void render() {
}
public void run() {
long lastTime = System.nanoTime();
double amountOfTicks = 60.0;
double ns = [telefone removido]/amountOfTicks;
double delta = 0;
int frames = 0;
double timer = System.currentTimeMillis();
while(isRunning) {
long now = System.nanoTime();
delta += (now - lastTime)/ns;
lastTime = now;
if(delta >= 1) {
tick();
render();
frames++;
delta--;
}
if(System.currentTimeMillis() - timer >= 1000) {
System.out.println("FPS: "+frames);
frames = 0;
timer+=1000;
}
}
}
}
