Overloaded java methods Marc Stiegler (marcs@skyhunter.com)
Fri, 20 Nov 1998 11:26:04 -0800

<bigger>E works pretty well for CGI-like programs as I said earlier. On to greater challenges, right?</bigger> <bigger>So, I was building the gui part of a slightly fancier app, and I decided to use a BorderLayout. I used add(button, "Center") to stick a new component out there in the Window. Sorry, illegal argument exception.</bigger> <bigger>Java containers have about five methods with signature add(a, b). Is there any way for coping with this? I have solved the immediate problem by using a GridLayout with a 3-parameter add with a unique signature.
</bigger> <bigger>Is the only general purpose solution to write a
subclass in Java of the class you want to use, and add new methods with distinct signatures that forward the message to the old method?</bigger> <bigger>--marcs