2

Okay, researching I saw a lot of posts regarding to the topic "hide close button from dialogs" but none of them solved my problem.The thing is I have this Dialog:

enter image description here

which I would like to keep the decoration (borders, transparency and etc) but I would like to hide or remove the close button component cos I will handle this with the cancel button.

If I use

setUndecorated(true);
getRootPane().setWindowDecorationStyle(JRootPane.NONE);

the result I will get is

enter image description here

which for me its completely terrible(not at all here since nothings on background)...so I ask: is there another way to handle this problem with dialog or setUndecorated and getRootPane are absolute? Futher suggestions are very welcome. Thanks in advance.

Community
  • 1
  • 1
Victor Oliveira
  • 3,293
  • 7
  • 47
  • 77
  • 3
    According to the answers in this question: http://stackoverflow.com/questions/942056/remove-x-button-in-swing-jdialog, it doesn't seem possible without creating your own `JDialog` –  Aug 08 '13 at 11:55
  • 1
    I think I will deal with another JDialog pumping up alerting that this will call the search. That might be easier instead of handle with one native API – Victor Oliveira Aug 08 '13 at 12:04

1 Answers1

3

You cannot remove the "X" button without messing with UI code (low level LAF or even native api), I dont know is it worth of the effort. However, if you REALLY REAAAALLLLLY need such functionality (and you will get lots of money for that;P) you can always write native code that would hide the X button (yes that is totally possible), but again, that is not worth of your time :)

Antoniossss
  • 31,590
  • 6
  • 57
  • 99