Can an event be user-defined and used in this situation?
Posted on 2003-02-23
I am practicing Java by developing a client/server connect4 project (not a homework project, I have graduated college years ago. just a project to help myself to learn Java).
The app is primarily composed of a Frame that contains a class representing the Gameboard, and a Status window that is a TextArea.
Problem: When a connect 4 occurs on the Gameboard I would like the Status TextArea to display "CONNECT 4" or something to that effect and not allow more mouse clicks on the Gameboard until the game is reset.
Q. When a player gets connect 4, could that be considered an Event and if so, is it possible to write user-defined events in Java and consequently it's handler? Any pointers on how this would be done?
I know this can be done without events, but think that if events can be used, it would be a more elegant solution. What do you think?