Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Swing: Change icon

Posted on 2011-09-28
4
Medium Priority
?
266 Views
Last Modified: 2012-05-12
Is it possible to change the icon that appears at the top-left corner of the title bar in any Swing window? By default, it is the java logo.

If yes, please let me know how. Thanks!
0
Comment
Question by:dshrenik
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 36718286
check here:
http://www.java-forums.org/awt-swing/5373-how-change-window-icon.html

    In the Netbeans properties window for your form, try iconImage. Otherwise, try:
    Java Code:
    1
    2
          
    Image icon = Toolkit.getDefaultToolkit().getImage([COLOR=#0066ff]"icon.gif"[/COLOR]);
    frame.setIconImage(icon);

0
 
LVL 47

Accepted Solution

by:
for_yan earned 2000 total points
ID: 36718323
Yes, i tried, and it acuatlly worked for me like that:
 public MyFrame(){
        super("My Frame");
        Image icon = Toolkit.getDefaultToolkit().getImage("icon.gif");
           this.setIconImage(icon);
....
   

Open in new window

0
 

Author Comment

by:dshrenik
ID: 36718490
The above code is in the constructor of my class that extends JFrame?
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36718495
Yes, exactly
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question