Here's a not-quite-generic version in Java, but could easily be modified to be generic to your needs:
https://github.com/frc1675/frc1675-2...PadButton.java
edit: looking at it again, this is such a short class that "modifying it to your needs" is basically rewriting the class, haha. I also looked at the javadoc for InternalButton, and we didn't use this as one, but I'm pretty sure it could just extend InternalButton instead if you wanted access to setPressed().