Icon for the JFrame

Hi,
I just wanted to start with WebStart. So I tried a very simple piece of code. A little Swing Window with a panel in it etc.I want the window to have its own Icon in the upper left corner under windows. First I wrote as I would do normaly for my java applications. There is the following in the main method of my own JFrame Class called Tis (public class Tis extends JFrame):
public static void main(String[] arg) {                    // Hauptmethode
     Image programmIcon = Toolkit.getDefaultToolkit().getImage("tis.gif"); // Icon
           Tis myTis = new Tis();                    // Instanz von Tis erzeugen
     myTis.setIconImage(programmIcon);               // Icon zuweisen
     myTis.show();                         // Fenster anzeigen
}Now I learned that I need A classLoader to access Files.So I changed the code to:
public static void main(String[] arg) {                    // Hauptmethode
           Tis myTis = new Tis();                    // Instanz von Tis erzeugen
         ClassLoader cl = myTis.getClass().getClassLoader();     // Aktuellen Classloader holen
     Image programmIcon  = new ImageIcon(cl.getResource("tis.gif"));   // Icon erzeugen
     myTis.setIconImage(programmIcon);               // Icon zuweisen
     myTis.show();                         // Fenster anzeigen
}The Problem is, that the classLoader will only load to a ImageIcon what is a Swing Class. But The JFrame's setIconImage() is inherited from the basis AWT Class and will not accept the ImageIcon class. I read through the docs and faqs, but found no answer to this. unfortunatly I cant find the source-code for the demos that sun is providing on this website. So at this moment I cant help myself any further.
Someone an idea ?
Thanks
- Frankie

And remember to use the exact case!
Example:
Under Windows you would get away first with
getImage("tis.gif")in case the file is stored on the disk and later in the jar file
as "Tis.gif" and you execute your programm via java foo.class.
When you later execute from a jar (using java -jar foo.jar) and/or via Web Start you would suddenly miss that resource, as the jar loader is case sensitive!
Regards,
Marc

Similar Messages

  • How to set the icon for the entire application with JFrame.setIconImage

    I set the icon on the main frame using JFrame.setIconImage(). The icon is shown properly in the main frame.
    If more JFrames are opened from the main frame, the newly opened JFrames also show the icon.
    However if JDialogs are opended, in some cases the icon set on the main frame is shown and in other cases the coffee cup.
    What is JFrame.setIconImage() expected to do? Setting the icon for a single JFrame or the entire application?
    How can I set the icon for the entire application?
    How can I set the icon for JDialogs?
    Thank you

    In order for your dialogs to use the same icon as the frame, you must parent the dialogs to the frame which has the custom icon.
    See the following thread for more information: http://forum.java.sun.com/thread.jsp?forum=57&thread=362542
    cheers,
    Greg

  • Icon of the jframe

    how can i change the icon of the JFrame?

    this if for u in two steps
    import javax.swing.*;
    one method is form toolkit method that i dont like
    other is simple
    ImageIcon ii = new ImageIcon("c:/hello.jpg");
    Image i = ii.getImage();
    jframe.setIconImage(i);
    thats it

  • The other day I had downloaded the latest version of Firefox and now none of the icons for the different websites I normally go to are there?

    As I said, the other day I had downloaded the latest version of Firefox and after doing so none of the icons for the different websites that normally go to are no longer there. Websites such as MSNBC, MSN, Most visited, that entire strip is no longer visible. I tired resetting Firefox and still nothing. Can anyone tell me how to get them to appear again? It's a hassle every time that I want to go to one of those sites I have to type it in the search bar, instead of just clicking on it as I did before. Please keep in mind if you answer, that I'm still learning about these things called computers and not very well versed in some of the things that you experts know:) Thanks

    On Windows XP Firefox shows the menu bar by default and not the orange Firefox menu button that is shown when the menu bar is hidden.<br />
    The menu bar is the toolbar at the top that shows menu items like File, Edit, View, History, Bookmarks, Tools, Help.<br />
    You can press the F10 key or tap the Alt key to bring up the "Menu Bar" temporarily in case this bar is hidden (View > Toolbars or Firefox > Options).
    The Navigation Toolbar shows the Back and forward button and the input field where you type the address of a site that you want to visit (aka location bar) and also has a search bar where you can type items that you want to look up with a search engine (Google).
    See also:
    *https://support.mozilla.org/kb/how-do-i-get-firefox-button
    *https://support.mozilla.org/kb/Menu+bar+is+missing
    *https://support.mozilla.org/kb/Browsing+basics
    *https://support.mozilla.org/kb/Tabbed+browsing
    You can attach a screenshot in case you still have problems with the toolbars to show what you want to change.
    *http://en.wikipedia.org/wiki/Screenshot
    *https://support.mozilla.org/kb/how-do-i-create-screenshot-my-problem
    Use a compressed image type like PNG or JPG to save the screenshot.

  • How to restore icons for the bookmark in osx lion

    The icons for the bookmark have disappeared.  How do I get them back?

    Are you by chance talking about the little icons in the bookmark menus in Firefox?  If so here is the fix from Mozilla:
    If it's something else please be more specific.

  • I have trouble seeing the small icons for the program functions in this tutorial.

    Hello,
    I have my assets from an older site, and want to start a site desktop site in muse. Is there a program ( maybe a book ) that can walk me through this step by step, instead of the Katie's Cafe demo / tutorial?
    The problem with the tutorial is in the dark interface I have trouble seeing the small icons for the program functions.
    I really need to setup a new site as soon as possible, but am not getting there right now.
    Thanks.
    Patricia Goff

    You can download the pdf from here :
    https://helpx.adobe.com/pdf/muse_reference.pdf
    Thanks,
    Sanjit

  • HT204291 I cannot find the AirPlay icon for the life of me. I have iOS 7.0.2 on my iPad Mini. Connected to my WiFi network just fine. I swipe up to get to the control center badges and all I see is the AirDrop icon. Trying to disable mirroring on ipad for

    I cannot find the AirPlay icon for the life of me. I have iOS 7.0.2 on my iPad Mini. Connected to my WiFi network just fine. I swipe up to get to the control center badges and all I see is the AirDrop icon. Trying to disable mirroring on ipad for Netflix streaming and don't know what to do. Any luck out there?

    If you last used an Apple TV to mirror your device and have updated to the newest Apple TV software, go into settings and turn airplay back on. The icon should then appear on your iPad mini when you swipe up allowing you to disable it for Netflix. After updating my Apple TV software for some reason it turned airplay off.
    Bob G

  • HT202159 Problem with Update on   It started, then the screen went white and the icons for the apps on the desktop were all blackened, 'waiting'.  What now?

    It showed a number of apps to be updated on my iPad, so I clicked 'update all' as usual.  It started, then the screen went white.  The icons for the apps on the desktop went black, as they do, with the first one half way around the little circle timer, and two marked 'waiting', with others not that far into the process.  They all stopped.  Now I can't stop the update process in the App Store, or use any of the apps.  What do I do next?  Help, please!

    Hello there, Rev Susi.
    From what I can gather you have a few apps that only display "Waiting". The following is a past discussion that dealt with a similar issue, the answer may help you as well:
    App updates won't download on my...: Apple Support Communities
    https://discussions.apple.com/thread/4111336
    Try tapping the App, so that it changes to Paused instead of Waiting, then tap it again to resume the install.
    Make sure you don't have any paused downloads in other apps either, like the App Store or iTunes Store.
    If that doesn't do it, try resetting or restoring the iPhone.
    via whatheck
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • I got home today and got a message on Messages or IMessage and the Messages app would not open i restarted my computer and it had a question mark as the icon for the app. Help!?!?! What does this meen how can i prevent further damage or fix damage delt

    I got home today and got a message on Messages or IMessage and the Messages app would not open i restarted my computer and it had a question mark as the icon for the app. Help!?!?! What does this meen how can i prevent further damage or fix damage delt

    Is this what you see when you start up your MBP?
    http://support.apple.com/kb/ts1440
    Ciao.

  • Setting icon for the JMenuItem

    I am trying to set the Icon for the JMenuItem and not able to do so.
    I have the Images directory in the classes which has all the images. Is this the way to give the dir path. When do I give '\' and when do I give '/' or'//' or'\\'? Thanks.
    I gave
    JMenuItem mnuitmFileNew = new JMenuItem(new ImageIcon("Images//new.jpg"));
    and later in Jbinit() method I have this.
    mnuitmFileNew.setMnemonic('N');
    mnuitmFileNew.setText("New");
    mnuitmFileNew.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    mnuitmFileNew_actionPerformed(e);
    });

    Hi,
    I'm not sure if you've seen this yet:
    http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html
    If you still have any questions please post again.
    Regards,
    Matt
    Java Developer Technical Support
    Sun Microsystems

  • Icons for the Reports missing in Workspace after applying patches

    Hello Gurus,
    I have installed 11.1.2.2 on one of my VM's and then applied the 11.1.2.2.300 patch on it.
    I have followed the Read Me for all the patches before applying them.
    After applying the patches however the icons for the Reports in workspace
    [IMAGE ON THE FOLLOWING LINK]
    http://i45.tinypic.com/29f6mc0.png
    I have reconfigured web server at the end but that did not help. Any help will be highly appreciated.
    Thanks
    HyperionEPM.

    Hello Nick,
    Yes all the components show green and I can access the reports without any issues. Its just the icon that does not show up.
    I will check the logs you have mentioned to see if there are any exceptions in them.
    But the issues started up after applying the patches for 11.1.2.2.
    I have checked the location path mentioned in Weblogic.xml in raframework.war file and the path points to the correct folder location where the folders mt and mt_thumbnails are located.
    Is the any other way out?
    Should I delete the contents inside the tmp folder located in RAFramework0
    or
    Can reconfigurin Reporting and Analysis framework services help in resolving the issue?
    Please let me know.
    Thanks.
    hyperionEPM

  • How can I change the icon for the bookmarks menu button

    Using linux, the default icon for the bookmarks menu button is quite ugly. Is there a way to change the icon for the button with some code in userChrome.css ?

    After several intents, I found a solution.
    This is my userChrome.css file:
    @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
    toolbarbutton[class="toolbarbutton-1"]#bookmarks-menu-button image[class="toolbarbutton-icon"] {
    list-style-image: url("bookmark_gray.png") !important;
    -moz-image-region: rect(0px, 0px, 0px, 24px) !important;}
    Probably it's messy but works.

  • Bookmarks are saved yet after using the page icon is still displayed instead of the actual icon for the website. I have followed the directions for "Favicons do not display".

    My bookmarks, on a HP Pavilion dv-7-2273cl notebook, are saved yet the page icon is still displayed after using the bookmark instead of the actual icon for the website. I have followed the directions for "Favicons do not display" without any success. This problem is not experienced on my much older Gateway desktop.

    A possible cause is a problem with the file places.sqlite that stores the bookmarks and the history.
    *http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox
    *https://support.mozilla.org/kb/Bookmarks+not+saved#w_places-database-file

  • On iOS 7.0.2, after web (OTA) installation there are two icons for the app on the home screen; one is invalid.

    Hello,
    I have filed a bugreport, but I am curious if anybody else has noticed this.
    Summary:
    Icon that was displaying progress of installation stays on screen next to normal icon and it is impossible to delete it or start the app with it.
    Steps to Reproduce:
    1. Full factory reset of iPhone with iOS 7.0.2
    2. Open web page with link for OTA installation.
    3. After install is finished there are two icons for the app.
    Expected Results:
    Icon that was displaying the progress should disappear after installation.
    Actual Results:
    Icon that was displaying the progress stays on screen is not usable and cannot be deleted.
    Version:
    7.0.2
    Notes:
    Configuration:
    Server used to serve the page with installation files is "Server" app on MacBook Pro with Mountain Lion.
    The same happens if other servers are used; Ubuntu 12.04 LTS.

    Hello,
    I have the same problem!
    Any idea?
    Thanks.

  • I updated to OS X 10.8.5 and the icons for the files of one app have turned generic. How do I fix this?r

    I updated to OS X 10.8.5 and the icons for the files of one app were originally for another app (and opened it). I was able to make the files open the the original app but now the icons have turned generic. How do I fix this?

    Download Mavericks from the Mac App Store.
    (95518)

Maybe you are looking for