How add a new icon in the title bar?

does anyone know how to change the default "java icon" that appears on the title bar of a Window (in an application Frame)?

Hi,
use the method public void setIconImage(Image) in Frame (inherited by JFrame).
best regards

Similar Messages

  • How do you add a new icon to the home screen?

    How do you add a new icon to the home screen?

    The only new icons you can add to your home screen are webclips, which can be added by using the "+" button in safari on the desired web page.
    You won't be able to add new apps until February when the SDK is fully seeded to developers.

  • How to add an icon in the title bar,next to the maximize and minimize icons

    I need to add an icon ( help icon; ?) in the JInternalFrame� title bar. Anyone could help me????
    Thanks

    have you get the answer ?? on how you add an icon to the title bar?? ...
    if you do please inform me..
    thanks

  • 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();
    }

  • Disabling close 'X' icon in the title bar of JDialog

    I found that JDialogs by default come up with the close 'X' icon. The only manipulation that can be done is by setting the DefaultCloseOperation.
    Is there some way I can avoid showing that icon on the title bar?
    My JDialog already has a 'Close' button and I have written an action listener for it. I dont want to listen to WindowEvents as well.

    JDialog d = new JDialog((Frame)c, true);
    d.setSize(400,300);
    d.setUndecorated(true);
    d.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);That bit of code seems to get rid of the title bar entirely and cause a MetalLookAndFeel dragging bar without an X to appear.
    Let me know if this is a satisfying solution
    My full test code followsimport java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class DyalogTest extends JFrame
       public DyalogTest()
          super("Dialog Test");
          setSize(500, 400);
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          Container c = getContentPane();
          c.setLayout(new FlowLayout());
          JButton b = new JButton("Initiate Dialog");
          b.addActionListener(new ActionListener()
             public void actionPerformed(ActionEvent e)
                Component c = SwingUtilities.getRoot((Component)e.getSource());
                JDialog d = new JDialog((Frame)c, true);
                d.setUndecorated(true);
                d.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
                JButton b = new JButton("Dispose");
                b.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent e)
                      Component c = SwingUtilities.getRoot((Component)e.getSource());
                      JDialog d = (JDialog)c;
                      d.setVisible(false);
                      d.dispose();
                d.getContentPane().setLayout(new FlowLayout());
                JPanel p = new JPanel();
                p.setPreferredSize(new Dimension(400,300));
                p.setBorder(BorderFactory.createTitledBorder("Vanilla Dialog"));
                p.add(b);
                d.setContentPane(p);
                d.pack();
                d.setVisible(true);
          c.add(b);
       public static void main(String[] args)
          new DyalogTest().setVisible(true);
    }

  • Setting an icon in the title bar of a JFrame...

    Hi,
    how do I set an image (icon) in the title bar of a JFrame (in the top left corner)?
    In JInternalFrame there is a method
    public void setFrameIcon(Icon icon)to set an image in the title bar of this internal frame - but in a JFrame I didn't find any method like this...
    Thanks in advance
    - Stephan

    Thanks ICE, that works for me...
    this.setIconImage(new ImageIcon("img\\foo.jpg").getImage());- Stephan

  • Changing icon in the title bar

    Hi all,
    I've seen that applications like NetBeans have custom icons in the title bar of the application (instead of the standard Java Cup). How can I do the same? (i.e. customize the icon).
    Thanks in advance!

    One issue to be aware on Windows is that the icon you set is used both on the title bar (16x16) and when you <alt> <tab> between apps (32x32 or 48x48 on XP). This means that if you create a 16x16 icon it will look kind of chunky when you <alt><tab>. At work we get our art department to create a 48x48 icon that scales down to 16x16 well, a non trival task.
    IL

  • Odd action using the icon in the title bar of image in psCS5--???????

    i use imac, lion.
    by accident, i discovered that, clicking on and dragging the icon at the left of the title bar (actually within the title bar to left of file name),  i can sometimes open the
    image in ACR,  as hosted by BRIDGE (which is not running. i do not use bridge).
    sometimes the image will be duplicated following this dragging of icon, the new duplicate lying atop the image of the background layer, in the same window, and shows the diagonal bars awaiting resizing. if i just click the ("checkmark")  in the options bar to accept this new layer,  or, if i  press enter, i am looking at a new layer, which is a duplicate of the background layer. this new layer is a "SMART OBJECT", and functions as such.
    this happens only with JPG and TIF files, not with RAW.  i have ACR prefs set to open all supported jpg and tif files.
    i should note that none of this occurs if the image has been edited in any way. in fact, after any edit the icon in the title bar is not movable.
    i am having some difficulty describing a simple and quick process. i don't know if this is a bug, a feature, or the result of too much RED BULL!  i Just reread post and it does seem delusional.
    can anyone help?

    it seems to work with or without the shift key.
    I work with OS 10.6.8 and you are right that it works without shift, too.
    My surmise is that the title bar’s icon of non-dirty files (files that have no History steps save the Open-step or have just been saved) behaves like the file’s icon in the Finder as the behaviour seems to be exactly like a drag-and-drop from the Finder (as a Smart Object if set in the Photoshop > Preferences > General > Place or Drag Raster Images as Smart Objects, not if set otherwise) and works across files, too.
    I don’t think I had noticed that previously, but that behaviour may well be fully intentional.

  • Displaying an icon in the title bar of a web page

    Hi Friends,
    Pls temme how 2 display a given icon in the title bar of a web - page, i mean in the title bar of the web - browser which loads the page.
    Thanks in advance,
    Kottayam Achayan

    Hi Friends,
    Pls temme how 2 display a given icon in the title bar
    of a web - page, i mean in the title bar of the web -
    browser which loads the page.
    Thanks in advance,
    Kottayam AchayanIn web.xml, you can use the <icon> element to specify the image to be used.
        <icon>
            <small-icon><!-- Specify a 16X16 GIF or JPG --></small-icon>
            <large-icon><!-- Specify a 32X32 GIF or JPG --></large-icon>
        </icon>Hope this helps.
    Annie.

  • Changing the icon in the title bar

    How can I go about changing the Icon in the title bar that goes next to the title?

    setIconImage(Image image) for JFrame.
    setFrameIcon(Icon icon) for JInternalFrame.
    Take a look at the API.

  • Volume icon in the Title Bar of my Treo 800w?!

    I don't know completely how to explain this, but here it goes:
    I have a Palm Treo 800w for Sprint. Yesterday, I looked at my phone (that I've had for 3-4 months now) and noticed a symbol that I've never seen in Title Bar on the right-hand side. It was an icon for volume, except it provided more(and simpler) options for volume. When you click on it, it showed the volume levels you could choose, but you could also select On, Off, or Vibrate. I went to look at the icons provided in the User Guide, but it wasn't any of them. ALSO, this icon in the Title Bar replaced where my battery icon usually would go.
    Anyways, my phone died, and when I turned it back on, it resumed to normal and didn't show the icon anymore. I like that icon, so I looked all around on my phone and read the user guides, but found NOTHING! Please help me if you can!
    Megan
    Post relates to: Treo 800w (Sprint)

    Sometimes after you use the media player (and under other equally unpredictable circumstances) the volume/speaker icon replaces the battery icon. I don't think I've ever clicked it, so I don't know whether it's functions are duplicative of an equally convenient icon.
    Since most people are much more concerned about their battery life, every post I have seen here on this was a complaint about the change rather than a request for it.
    Anyway, I don't think there is any built-in way for users to change the icons on that bar. There might be third party software or registry edits to do it; that would require more research.

  • Displaying our own icon at the title bar of a frame.

    Hai,
    How do i display an Icon of my choice at the title bar of a frame or a dialog box.
    Thank you.

    Thank you shahidjava for the kind reply,
    I tried your code as follows but I'am getting an exception saying "wrong number of arguments in the method.".
    Can you please help this out.
    import java.awt.*;
    import java.awt.event.*;
    public class testIcon extends Frame
         public testIcon()
         setVisible(true);
         setTitle("mohammad afzal....!");
         setBounds(100,100,200,200);
         getIconImage("afzal.gif");
         public static void main(String args[])
         testIcon ti=new testIcon();
    }

  • Placing an Icon in the Title bar.

    Hello,
    i am unable to set an icon before the title in the title bar.
    i am using jdk1.4.
    could someone plz tell me how to do this.
    i have tried the setFrameIcon method...but it only works for internal frames...not for JFrame.
    By default it is the tea cup and saucer icon( well, that is what it is right?)...how can i replace this with my own icon?

    setIconImage ( new ImageIcon ( "image.gif" ).getImage () );
    put "image.gif" in the same directory as the .class

  • Set an icon in the title bar.

    Hello,
    i am unable to set an icon before the title in the title bar.
    i am using jdk1.4.
    could someone plz tell me how to do this.
    i have tried the setFrameIcon method...but it only works for internal frames...not for JFrame.
    By default it is the tea cup and saucer icon( well, that is what it is right?)...how can i replace this with my own icon?

    Try this,
    Toolkit kit = Toolkit.getDefaultToolkit();
    Image icon = kit.getImage("myicon.gif");
    setIconImage(icon);

  • How can I display icons on the bookmark bar?

    Does anyone know how to display a webpage's icon on the bookmark bar instead of the title? thanks!

    Use a JFrame not a JDialog.

Maybe you are looking for

  • Crystal Report viewing and Printing Issue

    Hi Experts                 I use crystal Reports for PO,AR Invoice,Delivery and many other documents.It takes more than 5 mins to view layout from crystal report and print sequence printing takes more than 10mins.Please Help me to rectify this issue.

  • HT4796 why aren't my files appearing?

    I used the migration assistant to transfer my iTunes folder from my PC to my Mac so that I wouldn't have any issues when I synced my phone to the new mac.   The music isn't showing up unless I sign out of my administrator account and sign in to some

  • Object found by SUIM, not visible in PFCG (same in AGR_1251 and UST10S)

    Dear All, In SUIM I get some roles listed when I search for a specific authorization object (S_USER_AGR in this case). Wehn I look at the role via PFCG however, the object is not visible. When I look at the role/profile via tables: - AGR_1251for the

  • In Crystal Server CMC, how do I release session licenses?

    I need to clear improperly logged out session that are tying up our licenses, and can't remember exactly what services I need to restart...can anyone helpl Thannks! Robin

  • Attachment URL as hyperlink

    Hi I am creeating a data view in sharepoint designer; its showing multiple items which I intened to style later; Each item has a PDF file attachment, I'd like the Tile to open this attachment when clicked, is this possible, I;ve seen some examples of