How to set an icon in title bar and minimized window

I would like to set my own icon in the title bar and in the minimized window of my java application, replacing the java coffee cup icon.
I am using:
frame.setIconImage(new ImageIcon("image.gif").getImage())
as was suggested previously in this forum at:
http://forum.java.sun.com/thread.jspa?forumID=31&threadID=5212059
This does create the icon in both places. However, it only works when I run the program from JBuilder 2006. It doesn't work if I run the program from the .jar or the .exe file.
How can I make it work for my .jar and .exe file?
Please help! Thanks!

BrigitAnanya wrote:
This is urgent! What? Replacing an icon is urgent? That's ridiculous.
Can anyone tell me how I can replace Sun's Java Icon?The way you were already told. Only if you aren't going to put the icon in your current working directory, don't write code that assumes the icon is in your current working directory.

Similar Messages

  • How to replace the icon in the title bar and minimized window

    I am not sure if this is a Swing question. But since nobody answered it in the Java Programming forum, let me place it here:
    I would like to set my own icon in the title bar and in the minimized window of my java application, replacing the java coffee cup icon.
    I am using:
    frame.setIconImage(new ImageIcon("image.gif").getImage())
    as was suggested previously in the Java Programming forum at:
    http://forum.java.sun.com/thread.jspa?forumID=31&threadID=5212059
    This does create the icon in both places. However, it only works when I run the program from JBuilder 2006. It doesn't work if I run the program from the .jar or the .exe file.
    How can I make it work for my .jar and .exe file?
    Please help! Thanks!

    It doesn't work if I run the program from the .jar...working example for a .jar
    import javax.swing.*;
    import java.awt.*;
    class Testing
      public void buildGUI()
        JFrame f = new JFrame();
        Image img;
        try
          java.net.URL url = new java.net.URL(getClass().getResource("Save.gif"), "Save.gif");//correct capitalization required
          if (url != null)
            img = javax.imageio.ImageIO.read(url);
            f.setIconImage(img);
        catch(Exception e){}//do nothing - default will display
        f.setSize(200,200);
        f.setLocationRelativeTo(null);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
      public static void main(String[] args)
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            new Testing().buildGUI();
    }

  • How to set mouse listener for title bar of JFrame ?

    Hi, all
    How to we can set mouse listener for title bar of JFrame ?
    Please help

    Again, why did you not state this in your original
    question? Do we have to ask you every time what your
    actual requirement is?
    As I said in your last posting, if you don't give us
    the reuqirement in you question we can't help you.
    Sometimes your solution may be on the right track
    sometimes it isn't. We waste time guessing what your
    are trying to do if you don't give us the
    requirement.
    I gave you the answer in your other posting on this
    topic. The AWTEventListener can listen to events
    other than MouseEvents.
    The Swing tutorial has a list of most of the events.
    Pick the events you want to listen for:
    http://java.sun.com/docs/books/tutorial/uiswing/events
    /handling.htmlthe first, i am sory because my requirement not clear so that it wasted everybody time.
    The second, thank for your answer
    The third, AWTEvenListener do not support listener event on title bar
    but ComponentListener can know when we can change frame position.
    please see below that ComponentListener can handle action:
    public void componentHidden(ComponentEvent e) {
            displayMessage(e.getComponent().getClass().getName() + " --- Hidden");
        public void componentMoved(ComponentEvent e) {
            displayMessage(e.getComponent().getClass().getName() + " --- Moved");
        public void componentResized(ComponentEvent e) {
            displayMessage(e.getComponent().getClass().getName() + " --- Resized ");           
        public void componentShown(ComponentEvent e) {
            displayMessage(e.getComponent().getClass().getName() + " --- Shown");
        }Thanks for all supported your knowledge, you are great !

  • Missing icons in tool bar, and install window always opens when opening browser

    firefox hard drive installer icon appears, and installer window opens every time firefox is opened. Also 50% of the Icons in the tool bar minu are gone and just a dotted square is left.
    help

    Try to update to Firefox 11 via Firefox > About Firefox
    *https://support.mozilla.org/en-US/kb/Updating Firefox
    Make sure that Firefox gets installed properly.
    Open the Firefox disk image (DMG) file and drag the Firefox program to the application folder on your hard drive.<br />
    You shouldn't double-click the Firefox application to run it from the disk image, but drag it out of the DMG folder instead.
    *https://support.mozilla.org/kb/Installing+Firefox+on+Mac
    *http://kb.mozillazine.org/Installing_Firefox#Mac_OS_X
    Try to restore favicons with this extension:
    *CheckPlaces: https://addons.mozilla.org/firefox/addon/checkplaces/

  • Different icon for Frame's title bar and alt tab

    I have been using Frame.setIconImage to supply the image icon for the title bar and (on Windows, the <alt><tab> image). The trouble is there is only one image for both but one is usually small 16x16 and the other is usually large 32x32. What I have been doing is creating an image that is 32x32 but scales back to 16x16 and still looks good.
    The trouble is it is tricky to create graphics like that. I wondered is there a way to specify one image for the title bar and another image for the <alt><tab> image?
    thanks,
    Ian

    Has anyone encountered this problem before? Is there
    a solution? Or can anyone say definitivly that
    specifying the title bar icon and the <alt><tab> icon
    separately is not possible?Sorry- you can't do it. Windows apps can do this easily because they use a .ico that can contain both the 16x16 and 32x32.
    There are a couple of hacks I tried once, trying to swap icons based on events, but they are horrible hacks and don't work well enough to use. Your choices are as follows:
    1. Use a 16x16 .gif as your icon and have it look good in the upper left hand corner of your frame but horrible during alt-tab,
    or
    2. Use a 32x32 .gif and have it look poorly in the upper left hand corner of your frame but good during most other times.
    I'd choose #1.
    (The reason behind all of this is Java does a much worse job of resizing your icon than you could do yourself with a little work in Paint Shop Pro.)

  • How can i change/set a new icon on title bar in JFrame

    hi
    i want to change the icon of title bar on JFrame
    plz help me as soon as possible.
    thankyou

    I took you longer to post you message than to read the api documentation on JFrame. There is a method dedicated to changing the icon of the JFrame.

  • How to set image icon to JFrame

    Hi all,
    how to set image icon in the title bar of JFrame
    Thank for your help in advance

    thanks
    I have done as:
    Image image;
    image=getToolkit().getImage("database_yellow.png");
    if(image==null)System.out.println("fault
    n("fault image");
    this.setIconImage(image);
    but when I run my application, I can't see the database_yellow.png in the
    title barHm, strange ... from the code snippet you just posted I can't find the error.
    This may seem weird, but try to load a small .gif image instead ...
    Are you sure the Image is not equal to null?
    kind regards,
    Jos

  • .exe icon an title bar icon

    I have searched the board but couldnt find an answer. I hope someone here can help me. My problem is as such, whenever I create a custom icon for my .exe, the icon for the .exe file remains as the default labview icon but title bar icon for the program changes. How do I make sure that the icon for .exe file changes aswell. I already created a .ico file and i'm running labview 8.5.
    Thanks.

    Your .ico file should also include a 16x16 32 colors icon (or 16 colors, I don't remember) and that will be used for the window title. Personally, I use IcoFX for creating icons, which is free, but I assume that the icon editor in 8.x can allow you to do this as well.
    Try to take over the world!

  • How to set different Icons for Jtreenode

    How to set different Icons for Jtreenode,i want to set icons for jtreenode,not only for leaf,open,closeicon,i hope that each node has a different icon.Thanks!

    you need to check for the node value within a renderer, then assign an icon based on what you expect to get back.
    check out this page. http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html

  • How to set different icons for different windows which is seen in the top left corner?

    Hi
    How to set different icons for different windows which is seen in the top left corner? I know when building exe there is a option to edit icons or add icons and that icon is default for all the windows in the project. But i want different icons for different windows which is possible in VB.
    Is there any way to set icon by calling any dlls.
    Thanks & Regards
    Samuel J
    [email protected]

    Hi Sam,
    no problem. See the attachment.
    Mike
    Attachments:
    TestIcon_LV85.zip ‏44 KB

  • I had purchased Imovie today I can find the icon movie it click it but it will not open. Its shows up in docs and purchased but not apps? how do i add it to my bar and open it?!

    I had purchased Imovie today I can find the icon movie it click it but it will not open. Its shows up in docs and purchased but not apps? how do i add it to my bar and open it?!

    Exactly where are you clicking, you need to be specific. For example, are you using the Dock, the Applications folder, Launchpad, etc. to attempt to start teh app? Also IOS 7.1.2 does not run on a Mac, what version of OS X is installed on your computer?

  • How to merge title bar and tab bar on Gnome desktop?

    Not exactly a Firefox issue, but if it works fine on Windows it should work on Gnome too...
    How can I merge title bar and tabs bar?
    In Windows if we hide the menu bar Firefox puts in a single line Firefox button, tabs and minimize, maximize and close buttons. But in Gnome it keeps the separated title bar (with the minimize, maximize and close buttons).
    Is there any way to really implement it on Gnome Desktop?

    I want to back up what was said here. Chrome and Chromium have done this for as long as I can remember and the Linux distribution is entirely irrelevant in this case (as in most cases). There is an option to use the "system title bar and borders" in Chrome. If applied Chrome will have that blocky, chunky effect of not having the tabs overlapping into the title bar that firefox has. By default chrome does not use the system-provided title bar and borders. They wrote their own. The result is it looks nice. I prefer firefox by miles over Chrome, but have to admit it is chunky and ugly around the edges by comparison.
    The problem is not that it is "not possible in Linux." As a dedicated Linux user, hearing that oft-repeated phrase gets really old. There is nothing about Linux that makes things not possible when it comes to coding features. What is going on is the shortcuts available to make the coding quick and easy may not already exist. Fewer people use Linux, fewer people develop for Linux, and there is often less existing code base already written for Linux to make a coding job quick and easy. Also, there is less incentive to write original code to make something work for Linux because we are relatively few; the countless minions using Windows are all complaining about other things and much more loudly so.
    There is no doubt the task could be accomplished--which I would love to see--but the developers have to prioritize. I get that. Just wish they'd be honest rather than use the lazy answer of "It can't be done on your system."

  • Image window maximize over title bar and tools

    Hi,
    im working on a PC , with windows 7, with photoshop CS5
    i searched everywhere for answer , but none was given..
    people did mention this problem, but for different photoshop versions , and, i had it good till i dont know what happened and changed it, so i believe it is fixable but people understood it wrong.
    anyhow, the problem is, when you try to maximize the image window (assuming you changed it from tabs), the window maximize all over the screen, over the tools and title bar.
    instead of staying inside the workspace.
    as i mentioned, it used to be like it , but something happened and now its all over the thing.
    i tried double click the hand tool, all sort of things with the "F" and Tab shortcuts, the arrange documents thing on the top, even trying to restore default setting but nothing really did the trick.
    i tried to look for something called "Application frame", that somehow suppose to do just that, under window->Application frame, but its not there.
    again, it used to be ok so i know there is still hope..
    here it is restored, under "fit screen" option, notice it only get the hight right, i would not call it "fit screen" but what ever..
    red circels show the title bar and tools.. very nice and cool.
    and this is when i hit the maximize button and unleash hell, red circles are where the title bar and tools were, not so nice and cool..
    i noticed none of the others gave pictures, so i gave it a go..
    please help, there are no words to describe how annoying it is.
    thank very much in advance.

    If you want the Photoshop main window components to remain visible, either right-click on the image with the Zoom Tool selected and choose "Fit on Screen" (which really fits it inside the Photoshop workspace), or use Tabbed View.
    Pressing Control-0 (control zero) is a shortcut for Fit to Screen.
    I have no idea why Adobe changed the behavior.  Perhaps people reported that it was annoying to have the maximize window button not actually maximize the document window to fill the screen, which is really what it's supposed to do.
    -Noel

  • How to set up Airport Extreme for 11ac and 11n?

    I have just purchased the new Airport Extreme (August 2014) because Apple's website states
    Simultaneous dual-band support.
    AirPort Extreme features simultaneous dual-band 802.11ac Wi‑Fi. That means it transmits at both the 2.4GHz and 5GHz frequencies at the same time. So no matter which band your wireless devices use, they’ll automatically connect to the best available band for the fastest possible performance.
    I have number of Macs in my home from a new MacBook Pro with Mavericks to a Macbook Air with Snow Leopard (due to required software) and iPads.
    So after setting up the new Extreme my new MacBook only accesses 11n as does my older Macs. I checked by holding down the option key while clicking the WiFi icon at the top of my Mac. Well, not so automatic then as I was expecting 11ac and 3 times faster access (as stated by Apple).
    I then looked for some documentation for setting up but cannot find anything.
    Hence my question here.
    How to set up Airport Extreme for 11ac and 11n simultaneously?
    At present the new Extreme is no better than my previous 2 year old one.
    Thank you.
    Michael

    How to set up Airport Extreme for 11ac and 11n simultaneously?
    Assuming that it is operating correctly, 802.11ac and 802.11b/g/n are broadcast simultaneously by default.
    Simultaneous dual-band support.
    AirPort Extreme features simultaneous dual-band 802.11ac Wi‑Fi. That means it transmits at both the 2.4GHz and 5GHz frequencies at the same time. So no matter which band your wireless devices use, they’ll automatically connect to the best available band for the fastest possible performance.
    That is advertising. The real information is usually found in the small and hard to read footnotes:
    Based on theoretical peak speeds. Actual speeds will be lower.
    AirPort Extreme is based on an IEEE 802.11ac draft specification. Performance based on comparison with Apple’s 802.11n products. Comparison assumes AirPort Extreme network with 802.11ac-enabled computer. Speed and range will be less if an 802.11a/b/g product joins the network. Accessing the wireless network requires a Wi‑Fi-enabled device. Actual speed will vary based on range, connection rate, site conditions, size of network, and other factors. Range will vary with site conditions.
    Since the 802.11ac signal is being broadcast only using the 5 GHz band, some users report that they have had better results by using the option to assign a different name to the 5 GHz band, and then pointing their Mac to that specific signal or network. You may want to try that option.
    But first as a test, please locate the MacBook Pro about 10-15 feet or 3-4 meters from the AirPort Extreme with clear line-of-sight between the two devices. Restart both the AirPort Extreme and the Macbook Pro and then check to see if the Mac is connected to an 802.11ac signal.
    If not, please power off your other wireless devices...computers, mobile devices, etc. temporarily, and try the same test again.
    Please report on your results.

  • Cmd-click in finder on title bar opens new window - why?

    This is a feature I used all the time previously, but since I've updated to 10.5.2 it always open a new window when I select a dir further back. Does anybody know how I can make it not open a new window, just navigate in the existing window?

    ..."cmd-click in finder on title bar opens new window"...
    Holding down the cmd key while opening a folder in the "Finder" has caused the folder to open in a new window for quite some time. I can't recall what the behaviour was with respect to the Titlebar in earlier OS X versions, but if it has really changed in 10.5, perhaps it was to make it more consistent with the behaviour of folders in general.
    Are you sure you weren't using ctrl-click in the past?

Maybe you are looking for

  • Ical showing fewer hours to view

    i've tried using ical prefrences to start my day at 8am (I never do much earlier than that!!) despite changing this and the number of hours to view in the prefrences my ical insists in showing me 7 hours I don't need. If i reduce the number of hours

  • End-of-page in ALVs

    hi friends,        Is end-of-page possible in ALV reports,If how it is? what's that parameter Thanks & Regards RK

  • Delivery date control in Inbound

    Hi, If i am receiving goods after 10 days of the dilivery date mentioned in po, the system should not allowed to make Inbound Delivery. How can i do this in sap Regards laxman

  • 3rd gen nano locked in connect mode

    I have a 3rd gen Nano that was disconnected while charging without being ejected. Now it thinks it is still connected and I can't get it to do anything. I have tried resetting, plugging back in and trying to eject and restarting computer with it plug

  • Returned data from database field having data type CLOB

    hi.. i hv table having CLOB field type ... having 12000 char length ... data is present in the field... but when i do select on that field it only returns the limited data from that field for any given row... pls let me know wuts may b the problem...