2

I am developing a small project using Java Swing. I am using jdk 7 on windows 7.

I have the main window of my application (JFrame) and of course it has a "favicon" which I set (it doesn't even matter if it was the default java logo).

My question is: Is there any possibility to disable the click on favicon ? When I click I get that menu which is specific to all windows applications. Close, minimize etc.

I would like to ignore that click. I have searched a while on the internet but I found no answer, it seems like I am the first person looking for this.

Thanks.

tartak
  • 485
  • 3
  • 17
  • That may be an OS-specific thing and if so, it can't be fixed in core Java. You could use an undecorated window and provide your own pseudo-decorations I suppose. – Hovercraft Full Of Eels Feb 04 '12 at 19:37
  • You can hide the icon - http://stackoverflow.com/q/6868928/1048330 – tenorsax Feb 04 '12 at 19:46
  • Yes I can hide it, I can change it ... but the behavior @onClick will remain the same. – tartak Feb 04 '12 at 19:50
  • You always have an option to decorate the title yourself. Remove the default decoration and add your own. – tenorsax Feb 04 '12 at 19:57
  • *"it seems like I am the first person looking for this."* Always a good warning that what you are attempting 1) Is not what the end user would expect (not the 'path of least surprise') 2) Would therefore require extraordinary justification. What is *your* justification? – Andrew Thompson Feb 05 '12 at 00:59
  • I want to push my app to the limit and to do as much tweaking as possible; as I am not an experienced developer, I want to learn 110% of each experience. I have my own small parts of joy by doing this kind of _special_ stuff. – tartak Feb 05 '12 at 16:31

1 Answers1

2

To get rid of the menu set the frame to be undecorated (see Frame.setUndecorated) but then you'll lose the title bar and ability to reposition the frame using the mouse. Not such a great tradeoff.

A possible solution suggested by this question:

Removing a Frame's title bar keeping the resize mechanims - Java

is to use a com.jidesoft.swing.ResizableFrame that's undecorated. It sounds like you'll lose the title bar but still be able to resize the dialog.

Another option is to "hide" the icon, e.g.:

Image icon = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB_PRE);
myFrame.setIconImage(icon);

but the menu will still be present.

Why do you want to get rid of the menu? It's best to work within the look and feel of the OS and not redefine the user experience.

Community
  • 1
  • 1
Paul
  • 19,704
  • 14
  • 78
  • 96