
the steps are the following weighted:
1) The icon should be a picture of PNG extension. This is made easier, and to get a picture and make formats. ico is very complicated. The PNG help us a lot.
2) The image is the icon should be within the source package, like one more class. If you were inside a package, would be much better.

3) In the code we put JFrame icon, overwrite the method getIconImage () containing the following code: (note how it is calling the image. Png)
public
getIconImage Image () {retValue = Toolkit.getDefaultToolkit
Image ().
getImage (ClassLoader.getSystemResource ("resources / icon.png"));
return
retValue;}
4) In the design view of the JFrame, select it and let their properties, looking for the property "iconImagen" and click on the ellipsis button. You see a dialog like this:

From the dropdown list, select "existing component value." This will change the window as follows:

select the "Property" and click on the button hanging points. A dialog box will appear smaller, and select the property "iconImage" link there.

we click OK, and will look like:

and again click "OK" to close the image selection.
Now, we see that the JFrame properties and has a new value

execute the application with our JFrame JFrame and see a different icon.

0 comments:
Post a Comment