Cant change window Icon in a JFrame

I cannot seem to set the icon in the upper left of the window or in the task. I am using NetBeans and it created my JFrame for me using the following code to initialize:
java.awt.EventQueue.invokeLater(new Unable() {
            public void run() {
                new MainFrame().setVisible(true);
        });I have checked online tutorials and this seem to be a trully easy task BUT my JFrame, MainFrame, seems not to have the method I need....
I should be able too do this:
MainFrame.setIconImage(Image image); But it seems I cannot get that method in my JFrame at all, it just doesnt show up in NetBeans and wont allow me to compile. I have tried looking at the base JFrame class and see no setIconImage there either. Any help would be apriciated.
KN

Can you post the code for your MainFrame class. Use
code tags.Ok, 1st excuse the messy code, I am teaching myself Java and the code is a bit unproffesional. Also the code is large as it is a calendar program that allows you to input text into the actual calendar day boxes, loads, saves etc. Here is the declaration of the MainFrame class and the MainFrame constructor.
public class MainFrame extends javax.swing.JFrame {
    // Constants
    public final int DATE_HEIGHT = 17;
    public final int DAY_HEIGHT = 80;
    public final boolean DBG = true;
    public boolean Init = true;
    public int curMonth = 0;
    public int curYear = 0;
    /** Creates new form MainFrame */
    public MainFrame() {
        initComponents();
        for(int x = 0;x < 12;x = x + 2){
            jTable1.setRowHeight(x,DATE_HEIGHT);
            jTable1.setRowHeight(x+1,DAY_HEIGHT);
        jTable1.setDefaultRenderer(Object.class, new ColorCellRenderer());
        DateFormat dateFormat =
                DateFormat.getDateInstance(DateFormat.FULL);
        // Create our Gregorian Calendar.
        GregorianCalendar cal = new GregorianCalendar();
        cal.setTime(new Date());
        DaYear.setYear(cal.get(cal.YEAR));
        DaMonth.setMonth(cal.get(cal.MONTH));
        Init = false;
        LoadIt(curMonth, curYear);
    }KN

Similar Messages

  • How to change windows icons

    Hİ, 
    İ have apple icons and I would like to change windows 7 icons. 
    How can I do?
    subject edited

    you may need to install 3rd party applications to change the icons.
    which operation system do you have?
    http://www.microangelo.us/mod.asp

  • How can I change the Icon on the JFrame?

    Everytime, when I create an application, the default javalogo will show on the left top concern of the application which using JFrame, how can I change it to the other?

    Have you tried using the setIconImage method like this:
    JFrame F=new JFrame();
    F.setIconImage(Toolkit.getDefaultToolkit().getImage("myIcon.gif"));
    Here is what the API doc says:
    setIconImage
    public void setIconImage(Image image)
    Sets the image to be displayed in the minimized icon for this frame. Not all platforms support the concept of minimizing a window.
    Parameters:
    image - the icon image to be displayed. If this parameter is null then the icon image is set to the default image, which may vary with platform.

  • Cant change JLabel icon with setIcon a second time???

    Hey all,
    I have drawn 21 cards on my GUI - then as a user selects one of three columns via a radio button and subsequent Submit button, the deck reshuffles itself, and is THEN supposed to change all the labels to the new cards in their New order.
    All the code is good up until the point where it tries to reset the icon - and then I get a
    "AWT-EventQueue-0" java.lang.NullPointerException
    pointing to the line of my first Label that I am changing.
    I am trying to use the same settings as I did in the initial setting and think that maybe this could be my problem, but cannot find a proper setting in the Interface.
    My initial settings are this :
    for (i=0; i < 7; i++)
              cardscol1.setIcon(new ImageIcon("images\\" + deck.get(i)));
    cardscol2[i].setIcon(new ImageIcon("images\\" + deck.get(i + 7)));
    cardscol3[i].setIcon(new ImageIcon("images\\" + deck.get(i + 14)));
    THEN I tried this again (( INSIDE MY buttonHandler ))
    for (i=0; i < 7; i++)
                            j=0;
                            cardscol1.setIcon(new ImageIcon("images\\" + deck.get(j)));
    j++;
    cardscol2[i].setIcon(new ImageIcon("images\\" + deck.get(j)));
    j++;
    cardscol3[i].setIcon(new ImageIcon("images\\" + deck.get(j)));
    j++;
    And this is where I get the NULL POINTER EXCEPTION -- help??
    ****UPDATE:
    I cant access these Label PERIOD from within my Button Handler -- any idea why?

    OK -- the cardscol1 and 2 and 3 JLABEL arrays reference cards11, 12, 13, 14, etc. etc... THESE CARDS are within the initComponents class that is in a seperate class as well -- so that is probably my problem-- how do I get this submitButtonHandler class to see the cards that are in my initComponents class???
    AND THIS initComponents class is listed as PRIVATE!!! ((This is a class that the NetBeans GUI maker sets up -- very nice feature, but I cannot edit this class at all!))
    Message was edited by:
    tvance929

  • Cant change a icon..

    hello,
    I wanted to change the adobe suit's icons. I had no problem changing all but Indesign's icon does not change. It seems like its locked. I have never experinced this before.
    Anything I can do about it ?
    Thanking in advance.
    Gokce

    If you can't do it by means of the Finder Get Info panel then swap the app's icon in its bundle…
    Prepare the icon you want to use as an .icns. Quit from the app. Control-click on the app's icon and select "Show Package Contents". Open "Contents" and then "Resources". You will see the current .icns (probably called "InDesign.icns"). Drag it out and keep it somewhere in case you want to restore it. Give the icon you prepared exactly the same name as the one you just pulled out and put yours in "Resources". Close the folders.
    You may have to play around a bit with launching and relaunching the app, and/or logging out/in before Finder recognises the change. You may need to drag the app's alias from the Dock and drag it back onto the Dock.
     

  • Cant change bookmark icon

    basically what i have been trying to do is change the bookmark icon on my desktop for a web-link the link is for Air Droid ( i also have the Firefox addon on my phone) to transfer files but the icon is quite bad and easy to miss a white icon with a green paper airplane i have tried for multiple hours if you have any knowledge on the subject you can tell me please do share

    You will have to set an icon yourself to an shortcut on the desktop in the Properties via the right-click context menu if the current icon isn't distinctive enough.
    You can toggle the browser.shell.shortcutFavicons pref to see if that makes Firefox use the favicon for a desktop shortcut
    You can open the <b>about:config</b> page via the location/address bar.
    You can accept the warning and click "I'll be careful" to continue.
    *http://kb.mozillazine.org/about:config

  • Cant change profile icon to photo

    Keeps askin if I want to save or share when I press to add photo

    OK -- the cardscol1 and 2 and 3 JLABEL arrays reference cards11, 12, 13, 14, etc. etc... THESE CARDS are within the initComponents class that is in a seperate class as well -- so that is probably my problem-- how do I get this submitButtonHandler class to see the cards that are in my initComponents class???
    AND THIS initComponents class is listed as PRIVATE!!! ((This is a class that the NetBeans GUI maker sets up -- very nice feature, but I cannot edit this class at all!))
    Message was edited by:
    tvance929

  • Converting Windows Icons, how?

    Hey there...
    Does anyone know how to change windows icons to os x? I use a white PSP on my Mac and have finally managed to find a white psp icon to match the only thing is that it's in png format and I can't do the usual copy and paste from Get Info. Does anyone know how to convert these icons? Or does anyone know where I can get a white psp icon for the Mac? Thanks!

    Hi, Tymon.
    Graphic Converter can convert Windows ICO/ICN formats and PNG files to Apple Apple icon formats. Use the File > Convert & Modify option, select Convert in the Function pop-up menu, navigate to and select the files you want to convert in the left pane, select where they're to be saved in the right pane, select the desired Apple icon format in the Dest. Format pop-up menu, and you should be good-to-go.
    Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X

  • How can i change the icon in JDialog

    Hi,
    I have created a regular JDialog with new JDialog("Title");
    My problem is, the JDialog has the standard Java Icon.
    Is there a way to change this icon to a custom icon.
    I know you can change the icon in a JFrame, but haven't found anything how to change it in a JDialog.
    Any idea?

    Yep,
    there is no way to do it apart from using a different constructor:
    .... = new JDialog(Frame owner,String title)
    If you have set the Icon in owner , your JDialog will have the same icon.
    Phil

  • 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

  • How to change the icon for 'windows group' in Java 1.6 [Windows XP] ?

    Hello,
    I was wondering if there is a possibility to change the icon for 'windows group' in Java 1.6...
    I'm using Windows XP SP2. Now the windows from my Java 1.6 application are grouped with the standard Sun icon [screen below] on the group.
    http://img382.imageshack.us/img382/8995/iconbl1.png
    I would like to change the icon for my own. Is there a way to do that ?
    Please help.

    Whichever icon I use for the main frame (I tried few), after grouping the main frame and other sub-frames the icon is changed to standard 'Java Sun' icon as you can see in the screenshot from my first post. The problem occurs only when frames are grouped, when the are separated in the task bar their titles and icons are ok...
    So how can I change the icon/title for the group only (for Java 1.6 in Windows XP) ?

  • How to change the icon of the jar file w/o changing the windows setting

    I may be in wrong forum/area but I am not sure.
    I have created a windows executable jar file. Functionally it works fine. I can double click it to start my app. I want to change the icon of the jar file. I know I can change the icon for .jar extension in windows, but I want to be able to give a seperate icon for just this one file.
    All windows applications have thier own icon like Word, Excel etc. Is there any way I can do this for java apps? Also could this icon be kept consistent across platform say if I copy my app to linux? (Assuming it is not made for any particular os.)
    I am sure someone has come across this before.
    Thanks in advance.

    AFAIK you cannot specify an icon for a jar file. You can, however, specify an icon for a Frame using the setIconImage() method. This will have the effect of showing the icon in the taskbar for instance.

  • Want to change Form MDI Window default icon as well as default window icon

    Hi,
    I am using oracle forms 10g. I need to change the mdi window default icon as well as default window icon of inner form. But i do not know the way. Pls help me.

    http://www.oracle.com/technology/products/forms/htdocs/webutil/webutil.htm
    webutil lets you access the client machine from webforms. you'll need to install it on the application server and include the webutil library and object group in the form which will change the MDI window's icon (probably the first form in the application).

  • Change MDI WINDOWS ICON

    Hello Gurus,
    We were trying to change the MDI window ICON in forms through the procedure given in d2kutil.pll We did successfully finished and its running fine.
    But when we run the same form through a command prompt by passing necessary useir id credentials and parameters for the form(s) its throwing a error frm-90734 internal pl/sql error occured.
    i.e we are running the form like below from the command prompt.
    ifrun60.exe userid=scott/tiger@db module=d:\forms\icontest.fmx.
    But If we include the path of the EXE in the command prompt It does work very well.
    i.e d:\forms6i\bin\ifrun60.exe userid=scott/tiger@db module=d:\forms\icontest.fmx.
    Respective Dll and Pll is available in the same folder and has been included in FORMS60_PATH as well.
    Why is it due to, any suggestions on this will be much appreciated.
    Thanks

    Hi
    We did tried copied it in the current folder from where the fmx is running.
    Its 6i Client Server only.
    Thanks

  • Changing the icon that appears in GNOME panel window list

    I've been playing around changing all my icons and stuff, but I can't figure out how to change the icon that appears in the GNOME window list, a bit like a favicon. I've changed the icon path in the application's entry in /usr/share/applications, but that had no effect. Does anyone know how to do this? I'm hoping it's not hard-coded into applications.

    The location of the icon used can be different for each program. So what program specifically did you want to change?

Maybe you are looking for

  • How do I use Kerberos Auth in Java 6?

    Hi, I have a problem with the Kerberos authentication. I have a simple class that tries to connect to an LDAP server using Kerberos. It works great when I use java 5, but with java 6 it fails. Here is part of the code:         System.setProperty("jav

  • My phone is not showing up as a device on Find iPhone

    I have a phone and an ipad. When I go to Find Iphone to try to add my device, I cannot. I have turned on the locations settings, I have rebooted, I have updated my iCloud password and turned "on" everything that needs to be on. I have seen no fixes o

  • How to use LOOP(Until) step in a Workflow

    Hi, How to use LOOP(Until) step in a Workflow? What are the steps involved in using the step LOOP(Until).

  • Graphics don't display in pdf?

    When I view pdf's on my iPad 2, sometimes the graphics are fine, but often there are blank areas where some of the graphics should be. I create the pdf's in Adobe Acrobat 8 Professional by printing to a file from a variety of applications (Word, Powe

  • If I consider heap size, should I follow component binding or Value binding

    Hi, I have an Web application my pages gets change rapidly in run time(components get disable and invisible at run-time depends on user input), So in that case which kind of binding approach I have to follow if I consider Heap memory of run time.