Recently I was writing a small UI tool in Java Swing at work and found a strange bug in Java Swing, which was first reported in 1998 but is not fixed yet. I thought of documenting the workaround here so that it is useful for others who are faced with the same problem.
I wanted to trigger a popup menu when a right click event happens on a JComboBox (drop-down) component. I tried adding a MouseListener to the JComboBox, but it was not getting triggered. After spending a couple of hours, I finally came to know that it was because of a bug in Java Swing. The worst part is that the bug was closed as “Will not fix”
Fortunately, there is a workaround for this. Instead of adding the MouseListener to the JComboBox, you have to add it to all its children, like how it is done in the following code snippet.
After implementing this fix, I was able to trigger the popup when the combo box was right-clicked. Hope this helps someone who is affected by this bug.
I am a great fan of PDF documents and I am using Acrobat Reader right from version 4.0. But in the earlier versions I had only one complain. It used to take a long time for it to load. So I used to keep the main reader window open even if I am not reading a document so that then next time when I need to open a file I need not wait for it to load again.
But that has changed a lot in the latest version 7.0 of Acrobat Reader. Seriously Adobe has done some tweaks to make it load faster. But recently I found that it is loading lot of Plugin by default and a considerable amount of time can be reduced during loading if the optional Plugins are removed.
I was going through the installation directory of Acrobat Reader and found that there is an optional directory where we can put those Plugins which we do not want to load by default. This directory can be found in the following path (C:\Program Files\Adobe\Acrobat 7.0\Reader\Optional) and the Plugin directory can be found in this path (C:\Program Files\Adobe\Acrobat 7.0\Reader\plug_ins). I am assuming that you choose the default directory during installation. If you have installed it in a different directory then change the path accordingly.
The optional Plugins can be moved from the Plugin directory to the optional directory. Each Plugin can be identified but the extension (.api). But before doing that find out the Plugins which you are not going to use. You can see the list of Plugins and their dependencies in the Plugin’s page.
Click Help -> About Adobe Plugins.
You will see the following page.
From this page you can get a fair idea of Plugins that you don’t need and then move those corresponding .api files to the optional directory. While doing that please note that some Plugins may depend on other Plugins for loading. So if you get an error message stating that a particular Plugin was not able to load properly then restore the necessary Plugins. You will notice a significant improvement in the time taken for loading after moving the optional Plugins.
Here the list of Plugins which I have moved for your reference.
After retrieving the text I was thinking what a website can do by knowing your clipboard text and then an idea struck me what if it is combined with AJAX. The website can get the contents of the user