| |

VerySource

 Forgot password?
 Register
Search
View: 930|Reply: 4

How to change the icon on the program box?

[Copy link]

3

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-11-26 20:00:01
| Show all posts |Read mode
I want to remove the default icon and change it to a custom icon.
Reply

Use magic Report

1

Threads

51

Posts

32.00

Credits

Newbie

Rank: 1

Credits
32.00

 China

Post time: 2020-11-27 12:45:01
| Show all posts
kind of hard
JFrame.setUndecorated(true);
Then ADD the JPEG with IMAGE
Reply

Use magic Report

3

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-11-27 16:15:01
| Show all posts
It is to change the coffee icon on the program bar.
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 United States

Post time: 2020-11-28 10:30:02
| Show all posts
//Very simple, pay attention to the position of the picture

this.setIconImage(Toolkit.getDefaultToolkit().getImage(this.getClass().
                getResource("images/myicon.gif")
                          ));
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-11-28 15:00:01
| Show all posts
It doesn’t need to be so complicated, right?
If it is JFrame, call frame.setIconImage(new ImageIcon(url).getImage());//url is the image path
If it is JDialog directly dialog.setTitle("");
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list