alpaca princess (renniekins) wrote,
alpaca princess
renniekins

Work Amusement

I subclassed a Java class quite some time ago: the JComboBox. I did so to adjust its default behavior to match how we want our combo boxes to work here. Wanting to make another change, I looked over the source code again. When I originally did the work, I had to make quite a few additions -- plus I overrode two additional Java inner classes, so it would behave like I wanted it to. I commented what I did thoroughly, and some of my comments made me chuckle when I read them over today. At least I was honest....


// attempt to remove enter key. This doesn't actually work.

/**
* The following was copied from Java code for JComboBox:
* (But I'm overriding it anyway.)
*
* "This method is public as an implementation side effect.
* do not call or override."
*/

/**
* The purpose of this inner class is to override a single method in the
* BasicComboPopup computerPopupBounds, to cause the combo to go up
* instead of down, if going down will cause it to go off the Window
* which contains it. Java's version checks the screen size instead of
* the Window size, causing it to sometimes be obscured by the start bar.
*
* In order to do this I had to extend BasicComboPopup, instead of
* WindowsComboPopup, because of its protected class status. However I
* didn't see much utility in the Windows version, in fact none of the
* things it says it does really work, that I've noticed, so I don't think
* it will be a problem.
*/
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 3 comments