Frame icon for JDialog

Hi all,
I have a JDialog which is passed an instance of JFrame as parent component in its constructor.
The problem is that if i set the dialog as non resizable, the icon that appears in title bar(top left corner) goes.
It is visible only when the dialog is kept resizable.
Further the dialog is a modal dialog.
Please help,
Regards,
vikalp setya
[email protected]

To work around the bug, add this to your JDialog
      addComponentListener(new ComponentAdapter() {               // need this to prevent window resizing
         public void componentResized(ComponentEvent e) {          // can't use setResizable(false) because then the icon in the title bar is gone
            if (size==null) return;  // must be set elsewhere when JDialog is visible
            setSize(size);  // restore the original size of JDialog
      });;o)
V.V.

Similar Messages

  • Poster frames/icons for individual episodes on ipods?

    On ipods (at least ipod touch and iphone), podcasts show a poster frame/icon of that specific episode. Does anybody know what the rules are around that? We've been trying to add something to the front of our podcasts to standardize them for the first few seconds, but it still seems to show random frames from the episode. Any idea on how to control this?

    You are not telling what program you are using to make your podcast but assuming you are making podcast with garageband, you just have to drag and drop any image on the artwork at the left down side and this will be you EPISODE artwork

  • 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

  • JDialog - Frame-icon missing if resizable=false

    Hello friends,
    I have one JDialog which i create with this in the constructor :
    super(owner_frame,"Title",true);
    where 1st argument is the frame for which we set imageicon as
    setIconImage(img);
    Problem :
    Now whats happening that when for JDialog i make setResizable(true)
    I get this icon on the extreme-left-corner of the dialog BUT when i make
    setResizable(false) , icon disappears .
    Reason May be :
    actually when icon appears ( for resizable==true) and when we click that icon
    we get a popup-menu showing options for "Move","Size" and "Close"
    But after we make resizable==false , we dont need these options .
    Cant we get this :
    after we make resizable=false , cant we get the icon and when click
    that , popup-menu should show up with "Move" and "Size" options as disabled
    and only "Close" as enabled.
    please suggest what I should do to make it possible.
    thanx and regrds,
    Raj

    To work around the bug, add this to your JDialog
          addComponentListener(new ComponentAdapter() {               // need this to prevent window resizing
             public void componentResized(ComponentEvent e) {          // can't use setResizable(false) because then the icon in the title bar is gone
                if (size==null) return;  // must be set elsewhere when JDialog is visible
                setSize(size);  // restore the original size of JDialog
          });;o)
    V.V.

  • How to set my own icon for java frame ??

    I create a java class it extends JFrame. I want to change default icon on the left_top corner and using my own icon. It is a --.gif file. How to do it. When I try to modify it using setIconImage( Image image), I met problem. I cann't new Image("--.gif"). I don't know how to create a Image object using a string(file name). I try to use ImageIcon , but it is not image obj. Thanks. Gary

    According to the documentation setIconImage does the following: Sets the image to be displayed in the minimized icon for this frame. Not all platforms support the concept of minimizing a window.
    So,
    1) It does not change the icon in the top-left corner
    2) It does not work on all platforms.

  • 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.)

  • Icon on JDialog

    Hi ,
    Can anyone let me know how to set the icon in the caption bar for JDialog. I am passing the Frame in the constructor but he is not showing the icon of the Frame. Dialog is set as Modal.
    Constructor is like this:
    public MyDialog(Frame frame,String title,boolean modal )
    super(frame,title,modal);
    Please help me..

    Ah yes, forgot to mention that when you call setResizable(false) on a dialog, the icon disappears (does anyone know why?).
    If you realy must have an icon and want to restrict the size of the dialog, one suggestion would be to add a component listener to the dialog which sets the dialog back to a fixed size in the componentResized(ComponentEvent e) method.
    cheers,
    Greg

  • Setting icon in JDialog

    Hi all
    I have a problem setting an icon in a JDialog. Now I know that JDialog's icon image will be the same as the icon image of its parent frame. Hence, setting the icon image of the parent frame which launches the JDialog will set the icon for the JDialog. But the problem lies here. It does not work the way it should. The JDialog is not getting the icon from the parent frame. Can somebody help me out with this problem? Is there any other way to set the icon for the JDialog explicitly - say something like a setIcon().
    Help will be really appreciated.
    Thanks.

    Hi,
    there is no setIcon(). There are some problems when your JDialog is not resizable and modal. Try some combinations with resizable and modal to find out whether thats the reason.
    Phil

  • How to change the icon for print dialog?

    Hello,
    I have a JTable, and with the print() method, I'm able to bring up the Print dialog and successfully print the contents of the table. Example:
    myTable.print( JTable.PrintMode.FIT_WIDTH, myHeaderFormat, myFooterFormat );This works great, but one small detail I'd like to change is the icon in the top-left corner of the dialog. The icon is currently the default Java coffee cup icon, while the rest of my application uses my custom icon. I couldn't find any documentation in the API or tutorials that Java has listed which shows how to change the icon, so I'm not even sure if it's possible (but why shouldn't it be?).
    My question is this: Is it possible to change the default icon in the print dialog? Or do I have to either make my own print dialog somehow, or use a third-party print dialog?
    Thanks

    tjacobs01: Appreciate the assistance (despite your sass). I've already searched the API, tutorials, and this forum. I'm already well aware of the setIconImage() method for JFrame -- after all, that's how I set the icon for my other frames as I previously mentioned. However, I want to set the icon for the print dialog called from the print() method of JTable.
    How would I use setIconImage() for the print() method of JTable? The print() method returns a boolean value, not a JFrame, so I'm just not sure how to implement what you're saying.
    Thanks

  • 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) ?

  • Custom icon for JOptionPane.showInputDialog

    As a novice who's wading through Deitel's 'Java how to program', using java2 and j2sdk1.4.1 on JCreator Pro. I want to use my own icons on a small proggie i've written. I know that the format is:
    showInputDialog(Component parentComponent, Object message, String title, int messageType, Icon icon, Object[] selectionValues, Object initialSelectionValue)
    however this doesn't tell me how to write the code. how do i change the default '?' icon for my own icon?
    thanks for any help
    rgds
    adambi

    This should help you also
                ImageIcon ico = new ImageIcon("drag2.jpeg");
                Frame frame = new Frame();
                Object[] options = {"Yes, please",
                        "No, thanks",
                        "No eggs, no ham!"};
              JOptionPane.showInputDialog(frame,
              "What some eggs ?.",
              "My title",JOptionPane.ERROR_MESSAGE,ico,options,
        options[2]);also here is a good link for ya on dialogs
    http://java.sun.com/j2se/1.4/docs/api/
    GOOD LUCK

  • Unable to display blinking icon for JTree

    I am unable to see blinking icon for JTree node. If I use any other image which is not blinking, then I am able to see icon.
    If blinking image is used, it shows blank image.
    Please refer to following code.
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.net.URL;
    import javax.swing.ImageIcon;
    import javax.swing.JApplet;
    import javax.swing.JScrollPane;
    import javax.swing.JTree;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeCellRenderer;
    public class TreeApplet extends JApplet {
    JTree tree;
    DefaultMutableTreeNode root;
    DefaultMutableTreeNode node1;
    DefaultMutableTreeNode node2;
    DefaultMutableTreeNode node3;
    DefaultMutableTreeNode node4;
    private ImageIcon errorIcon = null;
    private URL resource = null;
    private static final long serialVersionUID = 1L;
    public void init() {
         errorIcon = loadIcon("images/errorBlink.gif");
         root = new DefaultMutableTreeNode(new ProcessInfo("root", "error"));
         node1 = new DefaultMutableTreeNode(new ProcessInfo("Node1", "info"));
         node2 = new DefaultMutableTreeNode(new ProcessInfo("Node2", "warn"));
         node3 = new DefaultMutableTreeNode(new ProcessInfo("Node3", "debug"));
         node4 = new DefaultMutableTreeNode(new ProcessInfo("Node4", "error"));
         node1.add(node2);
         node3.add(node4);
         root.add(node1);
         root.add(node3);
         setLayout(new BorderLayout());
         tree = new JTree(root);
         tree.setCellRenderer(new TreeRenderer());
         add(new JScrollPane((JTree) tree), "Center");
    private class TreeRenderer extends DefaultTreeCellRenderer {
         private static final long serialVersionUID = 1L;
         public TreeRenderer() {
              this.setBackgroundSelectionColor(Color.lightGray);
              this.setBorderSelectionColor(Color.BLACK);
         public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf,
              int row, boolean hasFocus) {
              super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
              setIcon(getStatus(value));
              return this;
         private ImageIcon getStatus(Object value) {
              DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
              ProcessInfo nodeInfo = (ProcessInfo) node.getUserObject();
              String status = nodeInfo.getStatus();
              if ( status != null ) {
              if ( status.equalsIgnoreCase("error") ) {
                   return errorIcon;
              return null;
    private ImageIcon loadIcon(String name) {
         ImageIcon icon = null;
         resource = this.getClass().getResource(name);
         if ( resource != null ) {
              icon = new ImageIcon(resource);
         return icon;
    }

    1. Use code tags to post codes -- [code]CODE[/code] will display asCODEOr click the CODE button and paste your code between the {code} tags that appear.
    2. A renderer is just a "rubber stamp" used to paint on the table/tree/list/whatever. You can't display animation in an ImageIcon by setting it to a renderer. Since the JLabel subclass used as the renderer isn't a part of any visible component hierarchy, the icon won't be refreshed with new frames.
    db

  • Automatically generate thumbnail image icons for all pix and vids...

    hello,
    i've searched around on the forums a bit about making the icons of my pics and vids actual thumbnail images made from the picture or the first frame of the video.
    a lot of responses are mistaking this question for "how do i put the window into icon view?" this infact is not the answer that i suspect a lot of windows converts are looking for.
    windows automatically makes such icons for all pix and vids if you put the window into icon view.
    i notice in at cmd-j or in the window preferences there is a checkbox for "show image preview" or something like that, but despite this being checked, my pix and vids do not show an image preview. i'm gathering that this information does not exist in the resource fork which mac uses to organize photos.
    is there any script or addition i can make to my system to automatically generate icons for pics and vids of all types? how to i suggest to mac that they add this functionality into the next release?
    thanks for your time,
    max

    The Finder will create icons "on the fly" for nearly all graphic type files (jpegs, tiff, psd, and so on) and display them in both icon view and column view, provided the appropriate view preference has been set. Movies will just have the generic movie icon in icon view, and have a "live" preview in column view, ie you can play them in preview mode. If you want to add a permanent thumbnail which will display in all views, and whether or not the preference has been set for a particular folder in Finder, you'll need to add a thumbnail to the file. There are lots of ways to do this for static pictures, even rather clumsy ways to do it for movies, but the easiest thing is to get CocoThumbX:
    http://www.stalkingwolf.net/software/cocothumbx/
    Drag and drop both static pictures and movie files onto the application and a permanent thumbnail is created. Indeed, it will create cool thumbs even for things like PDF and HTML files (code or rendered display). For movies to get a thumb, they must be in a format that QuickTime can read. It has a set of preferences for just how you want the thumb determined (eg random or at a certain time), and you can drop batches of movies or even folders to have it assign thumbs to multiple movies at the same time. It is a way cool piece of shareware.
    Francine
    Francine
    Schwieder

  • Frame freezes for no reason

    Hi,
    This must be a windows or java bug.
    My application works fine, but from time to time when I open a AWT FRAME it FREEZES... (not the application but the frame)
    I cannot click anywhere with the mouse, i cannot close it, and it does not show up in the Windows control bar. It is like it does not exist for the Windows OS and it doesn't accept any input from the mouse or keyboard.
    It is a dead buggy frame. In some computers I have no problem. In others this problem happens, and the client that does not understand Java nor programming think I suck.
    Has anyone ever seen this ????
    Sergio

    Hi,
    Thanks for everybody for spending your time helping me here.
    I cannot isolate this error. That's the reason of my desperation. All I can say is:
    - The frame shows up right
    - My application does not freeze, just the frame
    - By freezing I mean that it does not accept any input from the keyboard or mouse AND Windows (OS) does not show an icon for that frame in the control bar as it should.
    - I cannot close it, I cannot minimize it, I cannot type inside it, etc. It just sits there as an image in my desktop.
    - That's why I called it a dead buggy frame.
    - If I try to pop that frame again the new one freezes too, and it does not take too much moves to throw my whole application to the ground.
    - Again, it is just a simple frame, no multithreaded envolved, at least by my part.
    - It is not just with that frame, sometime other frames show the same behavior.
    Well, that's it. I am switching machines (desktops), and I am praying that this bug stops happening.
    I should have tried the scandisk/defrag process, but now it is too late, since that machine is gone. I will try that in this new machine if that problem reappears. But I don't even want to think about this possibility.
    Once again thanks for help,
    Sergio

  • Icon for webpage still has artboard on it when I insert it into page

    hi there
    I'm new to illustrator and also new to web design.
    I'm trying to put an icon I made into a webpage as a link, and well I'm not sure I have fully prepared the icon for this step.
    When I save my icon as a gif or any format really, it's not just the icon that gets saved but the artboard it's on, and well that's what gets put up on the webpage.
    Can anyone identify where I have gone wrong in preparing my icon for the web? How do I just have the icon and not the artboard?
    David.

    Well that would work but I have some pattern in there that has been masked so the frame of that pattern, even though it's not visible outside the icon, it's recognised when I use your techniqe Scott, so I'm going to try Monika's suggestions or try and work out how I can elminate that invisible frame. I'm not sure how easy that.

Maybe you are looking for

  • Error while trying to synchronize Audio and MIDI. plz help i cant hear anything

    plz help me i cant hear nothing and its says: Error while trying to synchronize Audio and MIDI. Sample Rate 38536 recognized. Check conflict between Logic Pro X and external device. ????????   PLZ HELP

  • Link a Form Field to new Text Field

    PDF - form field Looking for a code to link a form field(text_1, on page #5) to another, new form field(text_2, on pages 2-4). Maybe a "Page Properties" action (i.e., Page Open: field text_2 = field text_1) ~~ Why.... busy but here's why In the PDF,

  • Workflow is in error while posting parked document

    Hi All, I have implemented a workflow which will allow parking FI Documents via TC FV60 and then coding using FBV2 and then posting using FM:PRELIMINARY_POSTING_POST_ALL. While posting it came across a strange error "No batch input data for screen SA

  • How to have more than 8 release code for a release strategy

    Hi, In standard only 8 level of release is possible for a release strategy.  Our client requires more than 8 levels i.e., more than 8 release codes for a release strategy.  How can we achieve this? Pls provide your views/ideas. Reards,

  • Silent Install for WebLogic

    Hi, I am trying to install Weblogic 8.1 in silent mode. I found a web page that talked about using a silent.xml file which I tried. But, I still can't get it to work. Does anyone have a silent.xml file for Weblogic 8.1 they can post here or e-mail at