Icon on JDialog with setResizable(false)

Hi ,
Can anybody know how to provide an Icon on the caption bar for the JDialog when we set the resizable feature to 'false' ?
I observed, when we do setResizable(true), icon comes up but does not
show when we do setResizable(false).
Also when we use JOptionpane.showMessageDialog() which is not set as resiable does not show up icons as well. Can we do anything in this context as well ?
Thanking you in advance.

Leave resizing enabled an add a componentResizedHandler which pack()s the dialog.
Altough this will allow the user to resize the dialog, the dialog will also revert to it's initial size.
HTH,
Klaus

Similar Messages

  • Inserting Icons in JTextPane with setEditable=false

    Aloha!
    I'm working on this for years now, but i haven't found an acceptable solution yet.
    The problem: I have a JTextPane, where the user shall not be able to edit anything by clicking onto the JTextPane. So I have to setEditable=false. Now I want to insert an icon with insertIcon and therefore i have to setEditable = true. But for short time it's now possible for the user to click onto the screen and change the caretPosition, which must be prevented at all costs (because I'm working with the expected caretPosition of course)! This only happens when I try the brute force testing method, but it happens sometimes...
    So can someone give me a better solution than:
    setEditable = true;
    insertIcon(blahblah);
    setEditable = false;
    Thanks a lot for your attention,
    Holm

    To use HTML, you must use javax.swing.text.html.HTMLDocument instead of StyledDocument,
    Instead of StyleConstants, you must use javax.swing.text.html.HTML$Tag and javax.swing.text.html.HTML$Attribute.
    And you can use an HTMLEditorKit instead of DefaultEditorKit.
    this is an example of initialization:
    javax.swing.text.html.HTMLEditorKit htmlEditorKit = new javax.swing.text.html.HTMLEditorKit();
    javax.swing.text.html.HTMLDocument htmlDoc = (javax.swing.text.html.HTMLDocument)htmlEditorKit.createDefaultDocument();
    yourJTextPane.setEditorKit(htmlEditorKit);
    yourJTextPane.setDocument(htmlDoc);
    yourJTextPane.setEditable(true);
    yourJTextPane.setContentType("text/html");and you can use it by yourJTextPane.setText(HtmlCodeString)
    HTMLDocument and HTMLEditorKit allow you main modifications.
    thanks for duke dollars :)

  • Non Resizable JDialog with icon

    Hi All...
    How to create dialog with icon on the top left corner and also this dialog should be non resizable.
    Thanks
    sanjay

    Use setResizable(false) to make the dialog non-resizable.
    The Dialog automatically inherits the icon of the parent Frame/Dialog which is passed in the constructor.

  • Change Coffee cup icon on JDialog & JOptionPane

    I try to change the coffee cup icon on my JDialog and JOptionPane.
    My JDialog box does not load the Parent Icon (JFrame icon), and not even show a coffee cup icon.
    My JOptionPane would just show a coffee cup icon, eventhough its parent is the above JDialog with no icon.
    Is there anyone know how to fix this?
    I'd like show my icon on the JOptionPane instead of the coffee cup icon.
    And also to show my icon on the JDialog instead of nothing, not even a coffee icon.
    Any help is appreciated.
    CL

    Passing a parent with the desired icon to the JDialog/JOptionPane should solve your problem, however there is a bug in swing that prevents any icon from showing in the titlebar if a JDialog is made non-resizable (through a call to setResizable(false)).
    The bug adatabse says that this has been resolved but I am using jdk 1.3.1 and continue to have this problem.

  • 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

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

  • 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

  • Iconimage on a jframe disables when setresizable(false)

    hi Friends, I am new here , and this is my first post.
    I have a problem ie, when i am using "setResizable(false);" after setting an iconimage on a jFrame, that icon disables, but setResizable(false) function is truly achieved. But I also need that icon on my JFrame.Any help would be appreciated.Thanx in advance.

    the same is being postedin the swing section.

  • Closing JDialog with another JDialog

    How will I close JDialog with another JDialog?

    Have you tried something like:
    public class PowerDialog extends JDialog
        final JDialog weakling;
        public PowerDialog(JFrame owner, JDialog other) {
            super(owner, "Feel the power", false);
            weakling = other;
            JButton b = new JButton("Kill weakling");
            b.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    if (weakling != null) {
                        //weakling.setVisible(false);
                        weakling.dispose();
            getContentPane().add(b);
            pack();
    }

  • Transferred itunes library from Windows XP PC to new Windows 7 PC. plugged in 3rd gen Ipod. Ipod icon appears along with playlists, music etc. Songs are grayed out and won't play. Please help!

    I recently transferred itunes library from windows XP PC to new Windows 7 PC. The transfer was successful, however when I plug my 3rd gen Ipod Nano into the new PC, the Ipod icon appears along with the music, playlists, etc. The songs are shown but are 'grayed out' and wont play or sync.The 'Devices & Printers' window in new PC shows icon for Ipod driver & is OK. The icon for the Ipod appears but depicts a delta shaped warning icon that states that the Ipod is'not operating properly'. Tried troubleshooting. The troubleshooting message states the the Ipod is 'disconnecting'. Can you help me with this problem?        

    Then, I dropped the entire itunes file from the old PC (XP) into an empty external drive.
    That "itunes file from the old PC"?  Is that the iTunes folder, from the old PC, that was in the user home folder's Music folder?
    All of the library, playlists, etc. from the ipod as they always have been are shown, by they are 'grayed out' and will not open or play.
    That's on the iPod, correct?  Are all of your old playlists in iTunes, from the old PC, still there in iTunes on the new PC?  Are the songs in iTunes still playable?
    This document provides the steps to transfer a complete iTunes library between two computers.  See the section called External drive.
    iTunes: How to move your music to a new computer - Apple Support
    There are many steps, but this is a summary.  (1) On the old PC, consolidate all of your iTunes data into the iTunes folder.  (2) Copy this iTunes folder to the external drive.  (3) On the new PC (that has iTunes installed but NOT running), replace its existing iTunes folder with the one from the old PC (on the external drive).  When you run iTunes, it uses the iTunes folder from the old PC, and it should look like iTunes on the old PC (with all the playlists, ratings, play count, etc.), and your iPod will see the iTunes library as the same iTunes library (because it is the same library).
    If you did something different, and the old PC is still accessible, you may want to try it using the method from the linked document.

  • After I make a note in the notes icon that came with the ipad, it immediately is emailed to my email address and disappears from notes. How can I make it stay on notes?

    After I write a note in the notes icon that came with the ipad, it immediately emails it to my email account and erases it from the note pad. How do I make it stay on the notepad? I don't particularly want it emailed to me.

    I have a test with some questions (multiple choice, FIB, matching, etc). I have just one button to submit all the answers, and after submiting the student can see his score and review the test to know where he failed. He can't answer again. However, he can change the answer multiple times before submiting.
    "if i turn on success/failure captions the student will see them while answering" - before submitting
    "if i turn them off he wont know what's the right answer" - after submitting
    My results page is the default. I didn't use any variable. When i go to the results page after reviewing the test all the entry boxes are "wrong".

  • Can't install Firefox 4 on Mac OS 10.4.11. Firefox icon has circle with crossline in it when I download Firefox 4 and try to install.

    Can't install Firefox 4 on Mac OS 10.4.11. After I download it, the Firefox icon has circle with a crossline in it when I try to install.

    Sorry, the official version of Firefox 4 requires Mac OS 10.5 or later, and an Intel processor.
    You can download an unofficial version that works with 10.4 and PowerPC Macs from http://www.floodgap.com/software/tenfourfox/
    or you can download the previous version from http://www.firefox.com/all-older.html

  • The youtube icon that came with my ipad is gone. I recently downloaded an upgrade. Could it have happened then?

    The youtube icon that came with my ipad is gone. I recently upgraded my pad. Could it have happened then?

    The youTube App is gone because Apple's license to use it has expired.
    YouTube is still accessible on the iPad via Safari (or any other browser) at http://m.youtube.com/
    Sign in at this site and your favorites, etc. will still be present. Save the site icon to the iPad Home screen and you will have a replacement for the youTube App.
    There is also an iPhone youTube App in the App Store which works on the iPad as well as the Jasmine App.

  • This component requires that the embedded font be declared with embedAsCFF=false.

    I'm getting the following warning for my project.
    "warning: incompatible embedded font 'MyFont' specified for views::MyViewInnerClass0 (MyViewInnerClass0_61) . This component requires that the embedded font be declared with embedAsCFF=false."
    Here's what I have in my style.css file.
    /* CSS file */
    @namespace s "library://ns.adobe.com/flex/spark";
    @namespace supportClasses "spark.globalization.supportClasses.*";
    @namespace views "views.*";
    @font-face {
              src: url("assets/MyFont.ttf");
      fontFamily: "MyFont";
      advancedAntiAliasing: true;
      embedAsCFF: true;
    @font-face {
              src: url("assets/MyFont.ttf");
      fontFamily: "MyFont";
      advancedAntiAliasing: false;
      embedAsCFF: false;
    The 2nd font section I have is what is suggested as the fix in most places but that isn't working out for me. I wonder if I'm missing something else.

    I tried changing the name and it didn't work. Tried all sort of combinations too and none worked. Tried a different font and that didn't work too.
    Turns out the problem wasn't in the declaration of the fonts but where I was using it.
    I initially had the font declared globally
    global
       fontFamily: DroidSansMono;
    I saw that, in your comment you had mentioned "..then apply it to the component" so I applied the font to the label component
    s|Label
      fontFamily: DroidSansMono;
    and boom.. no warning. Problem solved.
    Thanks so much.

  • How do I display a JDialog with a JTextArea in it?

    Hello.
    How do I display a JDialog with a JTextArea in it?

    http://java.sun.com/docs/books/tutorial/uiswing/mini/index.html
    import javax.swing.*;
    import java.awt.*;
    public class Test extends JDialog{
         public Test(){
              JPanel contentPane = new JPanel(new BorderLayout());
              JTextArea ta = new JTextArea();
              ta.setText("JDialog with a JTextArea in it");
              setContentPane(contentPane);
              contentPane.add(ta);
              setSize(300,300);
              setVisible(true);
         public static void main(String[] args){
              new Test();
    }     

Maybe you are looking for

  • Can I export multiple folders at the same time, keeping the album structure

    I'm exporting all of my photos from 2010 so far. Is there a way to export multiple folders at the same time, while keeping the existing album structure? It seems that when I try it, iPhoto exports them all to the same folder. I really don't want to d

  • Is there a workaround to 10.4's new way of redrawing screens?

    I'm hoping that the people in this forum might understand my issue and and have some suggestions. I'm using a WebEx-type web meeting service called Pixion for web presentations. Now that I've upgraded from 10.2.8 to 10.4, the service is not detecting

  • XSLT with DOMSource

    I'm trying to do an XSLT transformation with DOMSource as follows: javax.xml.transform.Transformer transformer = tFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(new FileWriter(new File(FileName

  • TA21009 does a software update for mac os x delete files

    I need to update my mac lap top to update my itunes and want to know if I do will any of my music, pictures, or any other files get deleted in the process?

  • XL-Reporter : User Signature field

    Hi ! in XL-Reporter how to get the user signature of a document. i need to get the user who hav created a document ( eg. Purchase Inv ) i tried in composer, by taking 'Document Owner', but it displays as 'n.a'. how to get the user in XL-Reporter. Tha