Add image to JFrame title?

Hi, everybody
Can i add a image to JFrame title by side right system menu?
Thanks for your advice

Prior to JDK 1.4 you can't without using native code.
This is because the frame's title is displayed by the native windowing system.
All you could do is use JWindow instead of JFrame and draw the decorations yourself completely. This can have other disadvantages besides the amount of work, like for example the window not showing up in the task bar on Windows systems.
Using Merlin (1.4, currently in Beta) you can tell the frame to manage the title from the Java side using JFrame.setLookAndFeelDecorated(true).
In that case the title bar is a subclass of JPanel (class name is called something like BasicTitlePaneUI, look it up yourself) and you could add anything you like to it.
Hope it helps, Stephen

Similar Messages

  • How to add tooltip to jframe title?

    hi all
    does anyone knows how can i set tooltip for jframe title?
    thanks

    Since it's a slow Saturday and I'm in a good mood...import darrylbu.util.SwingUtils;
    import javax.swing.*;
    public class FrameTitleToolTip {
       public static void main(String[] args) {
          JFrame.setDefaultLookAndFeelDecorated(true);
          SwingUtilities.invokeLater(new Runnable() {
             @Override
             public void run() {
                new FrameTitleToolTip().makeUI();
       public void makeUI() {
          JFrame frame = new JFrame();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setSize(400, 400);
          for (JComponent component : SwingUtils.getDescendantsOfType(JComponent.class,
                frame)) {
             if (component.getClass().getName().contains("MetalTitlePane")) {
                component.setToolTipText("Tooltip for frame title bar");
                break;
          frame.setLocationRelativeTo(null);
          frame.setVisible(true);
    }You can get the SwingUtils class [_here_|http://tips4java.wordpress.com/2008/11/13/swing-utils/]
    db

  • Add a Button in JFrame Title Bar

    How can I add a button in JFrame Title Bar. I want to put on more button for docking after the closing button in the title bar.

    if you use JFrame.setDefaultLookAndFeelDecorated(true) then you can do it by extending the JRootPaneUI class of the L&F (the default is the metal L&F). that is not a easy task but if you want take a look at BasicRootPaneUI, there you will have to point it to a new TitlePane which you will have to create. to load all this you must use the UIManager class. if you need more explaination try reading on look and feel and customizing it.

  • Is it possible to add a button with image on the title bar(IDR)?

    I look through all the buttons in the example, All of them does not with an image on them.
    Is it posslbe to put a image on the title bar?
    Best regards?
    Blake Le

    hi, Julia,
    Sorry for the misleading. I want to add a button below the IDR area. And for common button it's OK.
    Now the situation changed , i need to add an icon to a button , to make the user interface more beautiful.
    Is that possible?
    Best regards,
    Thanks very much for your help.
    Blake Le

  • Add image to title produces blurred rectangle

    Premiere Elements 8.0.1 running on Win7-64
    If I try to add a jpeg image to a title as described by http://help.adobe.com/en_US/PremiereElements/8.0/Win/Using/WSA4307130-118B-44a7-9A27-9B62C 50A1F35.html then all I get is a light blue rectangle with fuzzy edges.
    If I uncheck "drop shadow" then the fuzzy lightblue rectangle disappears, and left is a rectangle showing the image boundaries. But te image itself is not visible. "Bring to front" makes no difference.
    How is this supposed to work?

    I used "Right-click in the Monitor panel and choosed Image > Add Image"
    I didn't add it to a text box. The Title didn't contain any graphics object when I added the image
    Pantera

  • Can anyone suggest me a simple way to add a background image to JFrame ?

    I want to add a background image to JFrame in a simple way rather than overiding the paint method or paintComponent method. Just like adding an image to JButton or JLabel using two or three lines of code. Is it possible ? r there any methods for this purpose ? if so pls give the code.

    JFrame as such does not provide an option to set a background image.
    Extending JPanel, over-riding its paintComponent() and setting it as the contentPane of JFrame is one way of doing it. Though you have to do the overriding, it is not very complex though.

  • Why I cannot change font  and Color in JFrame title??

    Dear sir:
    I try to change font and Color in JFrame title in code below,
    It display all html code, not expected formatted ones.
    but fail. Looks like no way to do it??
    Can somebody help??
    Thanks
    import java.awt.BorderLayout;
    import java.awt.Toolkit;
    import javax.swing.*;
    public class JFrameTester {
      public static void main(String[] args) {
         String iconPath ="file:C:/eclipse/workspace/Test/images/long.PNG";
         String title = "<html><body bgcolor=\"yellow\">" + "<img src=\""+iconPath+"\">" +
              " <font size=\"6\" face=\"Verdana\" color=\"red\"><b>"+ "New Tester" + "</b></font></html>";
        JFrame f = new JFrame(title);
        f.setIconImage(Toolkit.getDefaultToolkit().getImage("images/123.gif"));
        f.setSize(250, 250);
        f.setLocation(300,200);
        f.getContentPane().add(new BorderLayout().CENTER, new JTextArea(10, 40));
        f.setVisible(true);
    }

    Looks like no way to do it??depends on the L&F you want.
    here's one way
    import java.awt.*;
    import javax.swing.*;
    class JFrameTester {
      public static void main(String[] args) {
        JFrame.setDefaultLookAndFeelDecorated(true);
        UIManager.put("activeCaption", new javax.swing.plaf.ColorUIResource(Color.RED));
        UIManager.put("activeCaptionText", new javax.swing.plaf.ColorUIResource(Color.YELLOW));
        String title = "Hello World";
        JFrame f = new JFrame(title);
        f.getLayeredPane().getComponent(1).setFont(new Font("Tall Paul",Font.ITALIC,24));
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setSize(250, 250);
        f.setLocation(300,200);
        f.getContentPane().add(new BorderLayout().CENTER, new JTextArea(10, 40));
        f.setVisible(true);
    }

  • Inserting an image to Jframe and save it ,  in SQL database

    Hai guys,
    I just wanna know about the inserting image in to a Jframe (in netBeans) it will be a grate help if you tell me the way to call a image to Jframe through a Button click and save the image in MySQl database.
    Is anyone has a idea about this task, please tell me
    Thanks,

    Image class should work to get the data, then add it to a Canvas object, then you can save the bytes from the Image into an SQL statement through JDBC.
    The implementation details will vary based on which approch and database you select.

  • Unable to View the Images in OBIEE Title view

    Hi All,
    I am trying to add a image in the title view of Answers interface.
    I placed my image in jpeg format in the following 2 paths.
    C:\OracleBI\oc4j_bi\j2ee\home\applications\analytics\analytics\res\s_oracle10\images
    and
    C:\OracleBI\web\app\res\s_oracle10\images
    I restarted oc4j , biserver & presentation server..
    But I am not able to view the image. It shows a Red X botton.
    I checked my Internet explorer settingg. Everything is fine.
    Please guide me.
    Regards
    Mehaboob Jaan

    Ok here is my instanceconfig.xml file and i dont see anything called style.
    <?xml version="1.0" encoding="utf-8"?>
    <WebConfig>
    <ServerInstance>
    <DSN>AnalyticsWeb</DSN>
    <JavaHome>C:\Program Files\Java\jdk1.5.0_16</JavaHome>
    <CatalogPath>C:/OracleBIData/web/catalog/Arj</CatalogPath>
    <Alerts>
    <ScheduleServer>SSALWXPP072</ScheduleServer>
    </Alerts>
    <CredentialStore>
    <CredentialStorage type="file" path="C:\OracleBIData\web\config\credentialstore.xml" passphrase="secret"/>
    <!-- other settings ... -->
    </CredentialStore>
    <AdvancedReporting>
    <ReportingEngine>XmlP</ReportingEngine>
    <Volume>XmlP</Volume>
    <ServerURL>http://SSALWXPP072:9704/xmlpserver/services/XMLPService</ServerURL>
    <WebURL>http://SSALWXPP072:9704/xmlpserver</WebURL>
    <AdminURL>http://SSALWXPP072:9704/xmlpserver/servlet/admin</AdminURL>
    <AdminCredentialAlias>bipublisheradmin</AdminCredentialAlias>
    </AdvancedReporting>
    <!-- To configure a limited set of languages to be available to users uncomment the <AllowedLanguages> tag below and choose a subset set of language tags from the list. Values must be comma separated. -->
    <!-- <AllowedLanguages>cs,da,de,en,es,fi,it,ja,ko,nl,no,pt,pt-br,sv,zh,zh-tw</AllowedLanguages> -->
    <!-- To configure a limited set of locales to be available to users uncomment the <AllowedLocales> tag below and choose a subset set of locale tags from the list. Values must be comma separated. -->
    <!-- <AllowedLocales>cs-cz,da-dk,de-at,de-ch,de-de,de-li,de-lu,en-au,en-ca,en-cb,en-gb,en-hk,en-ie,en-jm,en-nz,en-ph,en-us,en-za,en-zw,es-ar,es-bo,es-cl,es-co,es-cr,es-do,es-ec,es-es,es-gt,es-hn,es-mx,es-ni,es-pa,es-pe,es-pr,es-py,es-sv,es-uy,es-ve,fi-fi,fr-be,fr-ca,fr-ch,fr-fr,fr-lu,fr-mc,it-ch,it-it,ja-jp,ko-kr,nl-be,nl-nl,no-no,pt-br,pt-pt,sv-fi,sv-se,zh-cn,zh-mo,zh-sg,zh-tw</AllowedLocales> -->
    <!-- <Disconnected><ArchiveIbots>true</ArchiveIbots><DisconnectedDir>disconnected</DisconnectedDir></Disconnected> -->
    </ServerInstance>
    </WebConfig>
    Please let me know how to add this and where to add.
    Thanks
    Jaan

  • GIF images in JFrame

    hi all, i'm trying to put a gif image in JFrame. The problem is the gif images gets flickering(fluctuation) while it is placed in a frame. i had also placed some labels near the image and all of them gets disturbed becoz of this gif file in frame. plz tel me a solution.
    Thanks .
    //MY CODE
    //~~~~~~~~~~
    import java.awt.*;
    import java.awt.Color;
    import java.awt.event.*;
    import javax.swing.*;
    class Label_ON_G extends JFrame// implements MouseListener,MouseMotionListener
      private Image image;
      JLabel label1;
      JButton button1;
      Dimension dimension=Toolkit.getDefaultToolkit().getScreenSize();
      public Label_ON_G()
           super("Display image example");
           getContentPane().setBackground(Color.white);
           getContentPane().setSize(dimension);
        setResizable(true);
        getContentPane().setLayout(null);
         Toolkit tk = Toolkit.getDefaultToolkit ();
         image = tk.getImage ("singlearea.gif");
        label1= new JLabel("RADHA");
        label1.setBounds(120,110,80,30);
        label1.setEnabled(false);
        add(label1);
        button1= new JButton("VIEW LABEL");
        button1.addActionListener(new ActionListener(){
             public void actionPerformed(ActionEvent ae)
              label1.setEnabled(true);
             System.out.println("ActionPerformed");
        button1.setBounds(600,600,100,30);
        add(button1);
        setVisible(true);
        show();
    public void paint (Graphics g)
      g.drawImage(image, 100, 100, this);
      public static void main (String[] args)
      {     new Label_ON_G();     }
    }

    There is no need to do custom painting to display an image.
    [url http://java.sun.com/docs/books/tutorial/uiswing/components/label.html]How to Use Labels
    Unless you know what you are doing, never override the paint() method of the JFrame. There is no reason to do this.
    If you need to do custom painting then you override the paintComponent() method of a component that extends JComponent.

  • How to add src, alt and title tags to a PS generated Web Photo Gallery

    I do some web design and need to add some tags to a web photo gallery created by Photoshop. Maybe this question should be directed to the GoLive / Dreamweaver Forum but since the gallery was created in PS I thought I'd start here.
    I need to add src, alt and title tags to the images in the web gallery. Normally this is as simple as working on the code in the html page in which the image sits but the PS gallery doesn't seem to be that simple.
    Can anyone tell me exactly how, and which files I need to work on, to add these tags to each of my 42 gallery images?
    Thanks.
    John.

    You can't do it in Photoshop.
    You can open the pages in a text editor adn easily ad any tags you want. They are simply html pages.
    If you really want to, you can use Dreamweaver or Golive. Using a text editor is generally faster and easier because you can just copy/paste between the files and not have to worry about code rewriting in the WYSIWYG applications. Don't believe the GoLive/Dreamweaver hype about "round trip code" they both will alter code.

  • To change the image by the title bar.

    Hi,
    I have been trying to change the existing image in the title of the report.
    I tried reducing the image size through paint. And once i add this image in the title, it is showing the cross mark with letters 'LOGO'.
    Thanks,
    Sindhu

    Have you restarted the services after updating your image?
    You might have to use below syntax for calling the image
    fmap:location/image_name
    location->something like
    s_oracle/Images
    Ex: fmap:Images/newlogo.gif
    If this is not helping can you share your screenshot of the Title thru email or any other form.
    If helps mark
    Edited by: Srini VEERAVALLI on Feb 12, 2013 9:36 PM

  • Displaying image in the Title bar

    hi ,
    can any one help me to display image in the JFrame Title Bar Left Corner, Right Corner, orMiddle ..

    double post http://forum.java.sun.com/thread.jsp?forum=57&thread=554453

  • How to add images into a java application (not applet)

    Hello,
    I am new in java programming. I would like to know how to add images into a java application (not an applet). If i could get an standard example about how to add a image to a java application, I would apreciated it. Any help will be greatly apreciated.
    Thank you,
    Oscar

    Your' better off looking in the java 2d forum.
    package images;
    import java.awt.*;
    import java.awt.image.*;
    import java.io.FileInputStream;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    /** * LogoImage is a class that is used to load images into the program */
    public class LogoImage extends JPanel {
         private BufferedImage image;
         private int factor = 1; /** Creates a new instance of ImagePanel */
         public LogoImage() {
              this(new Dimension(600, 50));
         public LogoImage(Dimension sz) {
              //setBackground(Color.green);      
              setPreferredSize(sz);
         public void setImage(BufferedImage im) {
              image = im;
              if (im != null) {
                   setPreferredSize(
                        new Dimension(image.getWidth(), image.getHeight()));
              } else {
                   setPreferredSize(new Dimension(200, 200));
         public void setImageSizeFactor(int factor) {
              this.factor = factor;
         public void paintComponent(Graphics g) {
              super.paintComponent(g);
              //paint background 
              Graphics2D g2D = (Graphics2D) g;
              //Draw image at its natural size first. 
              if (image != null) {
                   g2D.drawImage(image, null, 0, 0);
         public static LogoImage createImage(String filename) { /* Stream the logo gif file into an image object */
              LogoImage logoImage = new LogoImage();
              BufferedImage image;
              try {
                   FileInputStream fileInput =
                        new FileInputStream("images/" + filename);
                   image = ImageIO.read(fileInput);
                   logoImage =
                        new LogoImage(
                             new Dimension(image.getWidth(), image.getHeight()));
                   fileInput.close();
                   logoImage.setImage(image);
              } catch (Exception e) {
                   System.err.println(e);
              return logoImage;
         public static void main(String[] args) {
              JFrame jf = new JFrame("testImage");
              Container cp = jf.getContentPane();
              cp.add(LogoImage.createImage("logo.gif"), BorderLayout.CENTER);
              jf.setVisible(true);
              jf.pack();
    }Now you can use this class anywhere in your pgram to add a JPanel

  • PSE v13 on mac, organizer spontaneously adds images duplicates.  How do I stop this from happening?

    just purchased PSE v13 on mac, primarily using the organizer
    issue - Organizer spontaneously adds image duplicates. 
    How do I stop this from happening?

    I enter misc. items in each metadata file, ie. document title, author, description, keywords, copyright notice, etc.  Each image has it's own metadata file, with unique keywords, which are unique to that image. The keywords then show up on the right side of PSE organizer under 'imported keyword tags'.  Then I can select a keyword, unique to that image and wa...la... that image only appears in organizer.  I have been doing this for years (like probably 10). But this is the first time I have experienced the duplication issue.
    Not adding any auto-adjustments in Organizer as far as I know.
    The names are not duplicated in organizer, but appear as ie. scnr0122.jpg and scnr0122-1.jpg.  But the '-1' is not found on my server.  Apparently they are being added from another source.  Is it possible they are being pulled from a cloud server, ie. creative cloud or revel??  I do have the same files on those cloud servers, but am not intentionally duplicating the import.
    here is an interesting side item. 
    Did you know that a man was convicted of murder because of the info found in the metadata of his files?

Maybe you are looking for

  • My ipod will not downgrade from 5.0 or 4.3.5 to a 4.3 4.2.1

    my ipod will not downgrade from 5.0 or 4.3.5 to a 4.3 4.2.1 it is a 4G ipod touch im trying to downgrade to a 4.3 or 4.3.3 this ipod model is MC540LL right now i have 5.0 but there was the same problem with downgrade when i had a  4.3.5 firmware

  • Upgrading from CS4 to CS5 Prod Premium

    Please excuse me if this has been discussed (although I only found one short thread relating to my question). I have received my upgrade version of CS5.5 (DVD version). I am currently running CS4.2.1 Do I have to deactivate my current version before

  • Can I Create ...

    Directional buttons to be included in KeyNote presentations. I am working on one where I want to either force the user to quit or continue the presentation at one point. If this were FileMaker I could whip one up in second, but this is KeyNote so I c

  • Print Empty Workbook

    I have an unusual question... I would like to be able to print a workbook that returns no data. The reason I need to do this is for documentation purposes. We have several workbooks that check for various exceptions and if everything is right, the wo

  • Photos use 9.1 GB but are not visible

    #1.   I deleted via iTunes all my photos.  Yet it says I have 49 photos using 9.1 GB.  I am mystified how to clear this space.     iOS is still 8.1     #2.   In BOOKS, there are two title I want to remove, I think they are in iCloud, I selected the o