Here you can find the source of setDefaultIcon(final JFrame window, final String imagepath)
Parameter | Description |
---|---|
window | the target window |
imagepath | the image which should be icon |
public static void setDefaultIcon(final JFrame window, final String imagepath)
//package com.java2s; /******************************************************************************* * Copyright (C) 2009, 2015, Danilo Pianini and contributors * listed in the project's build.gradle or pom.xml file. * * This file is distributed under the terms of the Apache License, version 2.0 *******************************************************************************/ import java.awt.Toolkit; import javax.swing.JFrame; public class Main { /**//from w ww . j a v a 2 s . co m * Sets the icon for a window. * * @param window * the target window * @param imagepath * the image which should be icon */ public static void setDefaultIcon(final JFrame window, final String imagepath) { window.setIconImage(Toolkit.getDefaultToolkit().getImage(imagepath)); } }