Add maximumsize icon to title bar in JDialog

My question is how to add a maximumsize icon to the title bar of JDialog, i want to create a dialog that when user double-click the JDialog's title bar or click the maximumsize icon in the JDialog's title bar the dialog can be displayed as maximum size. it just likes Frame.
Thanks in advance!
lupeng
[email protected]

Hi Lupeng,
I can think of 2 approaches, firstly and probably the most easiest is to use a frame to mimic the behaviour of the dialog.
Secondly, implement your own L&F for dialogs by wrting your own RootPaneUI that uses your own version of TitlePane. The TitlePane class will take care of the buttons and mouse handling. Have a look at BasicRootPaneUI to get a better understanding of the implementation ;)
N35Sy

Similar Messages

  • .exe icon an title bar icon

    I have searched the board but couldnt find an answer. I hope someone here can help me. My problem is as such, whenever I create a custom icon for my .exe, the icon for the .exe file remains as the default labview icon but title bar icon for the program changes. How do I make sure that the icon for .exe file changes aswell. I already created a .ico file and i'm running labview 8.5.
    Thanks.

    Your .ico file should also include a 16x16 32 colors icon (or 16 colors, I don't remember) and that will be used for the window title. Personally, I use IcoFX for creating icons, which is free, but I assume that the icon editor in 8.x can allow you to do this as well.
    Try to take over the world!

  • How can i change/set a new icon on title bar in JFrame

    hi
    i want to change the icon of title bar on JFrame
    plz help me as soon as possible.
    thankyou

    I took you longer to post you message than to read the api documentation on JFrame. There is a method dedicated to changing the icon of the JFrame.

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

  • Add new button on title bar of JFrame

    how can i add new button (like minimize, maximize and close) on title bar of JFrame.
    actually i want a new button for system try icon. if user click on this button JFrame will hide and system try icon will be visible

    Hi,
    Check out this Thread.
    Hope that help,
    Jack

  • Disable close icon on title bar

    Is it possible to disable the close icon on the title bar (right hand corner) in a swing window?
    Fai.

    Example:
    frameNameHere.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    There is also the option to take away the "window-frame" alltogether with:
    frameNameHere.setUndecorated(true);
    Though if you do that you should probably use the "DO_NOTHING_ON_CLOSE" anyway, since otherwise it can still be closed with Alt F4 for instance.

  • How to set an icon in title bar and minimized window

    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 this 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!

    BrigitAnanya wrote:
    This is urgent! What? Replacing an icon is urgent? That's ridiculous.
    Can anyone tell me how I can replace Sun's Java Icon?The way you were already told. Only if you aren't going to put the icon in your current working directory, don't write code that assumes the icon is in your current working directory.

  • No icon in title bar for notification center

    I have no icon for Notification Center in my title bar.  System prefs seem to show NC is operational, but no icon...

    Read http://www.gizmodo.com.au/2012/07/the-os-x-mountain-lion-survival-guide/
    It may answer your question. NC in Mountain Lion is a bit inconsistent. Hopefully fixes coming soon.

  • How to add script icon to menu bar?

    On my MacBook Pro that was upgrated to Mountain Lion the script menu I installed years earlier remained after the upgrade. Just bought a new iMac and I can't find how to get the script icon in the menu bar. In Leopard, and maybe Snow Leopard, there was acutally a script to install the menu. The scripts I use work fine under Mountain Lion, I just want to add them to the menu bar. Any thoughts would be greatly appreciated.

    Open the applescript editor.app
    Preferences>show icon in menu bar

  • Cannot double click an icon or title bar

    i have just noticed since the last os update for snow leopard that when i double click the icon or the title bar nothing happens, whereas before i used to be able to either open a folder or an application, or minimize something with a double click. If anybody has ideas about what is going on, please write. Right now i can only open things up in secondary button mode, in the dock or the menu bar. thanks

    BrigitAnanya wrote:
    This is urgent! What? Replacing an icon is urgent? That's ridiculous.
    Can anyone tell me how I can replace Sun's Java Icon?The way you were already told. Only if you aren't going to put the icon in your current working directory, don't write code that assumes the icon is in your current working directory.

  • Rename and place icon on title bar of Flash exe file problem

    How to rename the title bar on Flash project file (.exe) and
    replace the flash icon with my own icon file?
    Thank you very much!

    You need a 3rd part Flash projector tool, of which there are
    quite a few:
    http://www.flashmagazine.com/1100.htm

  • To disappear / disable buttons on title bar of JDialog

    hi,
    i want a non-modal JDialog without any buttons on tilte bar.
    i.e i dont want to have the X close button on tilte bar. how can i achieve this
    thanx

    by setting undecorated true whole of the tilte bar goes off. but i just want
    to remove the close button on title bar. any how i found the soln by setting
    setDefaultLookAndFeelDecorated(true) which removes the close button
    from title bar.
    if there is any other method plz suggest

  • NI Icon in title bar

    Does anyone know how to remove or change the Icon on the left hand side of
    the title bar?

    When building an application using labviews app builder, click on the App
    settings tab and click the custom icon checkbox. Then point to an ico file
    that contains both a 32x32 and a 16x16 icon. Labview will do the rest.
    Icon editors are all over the web. Try looking at www.tucows.com or somewhere
    similar.
    Jared
    "Briggs Atherton" wrote:
    >>Does anyone know how to remove or change the Icon on the left hand side
    of>the title bar?

  • Online icon on title bar half missing

    dor some reason since updating to skype 6.19   on mac  os x yosemite beta, the  status inidactor on the  skype window  has only half appeared. ( the one between prof pic & profile name ).
    I have already tried  uninstalling & reinstalling skype.  Makes no difference.
    I have attached a screenshot  to show .
    Attachments:
    Screen Shot 2014-10-15 at 07.48.30.png ‏11 KB

    Becouse its on Mac OS? Superior OS :-P
    Merde!
    Attachments:
    Screen Shot 2015-01-06 at 13.53.49.png ‏47 KB

  • Setting icon in JDialog title bar.

    Hi all,
    Can u send me the code for setting the icon in the title bar of JDialog?
    Currently i'm working on linux.
    Is there any possible way to set it.

    1) Swing related questions should be posted in the Swing forum.
    2) Quit multi posting, you where given the answer yesterday when you originally posted this question.

Maybe you are looking for