At best this is going to be a kludge. RS-232 is for serial communication, not for digital input lines. However, if you want a single input line that can be read by the software then the modem line intended to tell the computer there is a incoming call could work. Depending on what access your software has to the serial port, is should be able to read that line. There are also lines for ring detect and a general ready line. I vaguely remember names of some of these lines are DSR, DCD. A detailed RS-232 reference should be easy to find out there.
Not all low level drivers make all lines available to the software. Wanting this in Java may add another compilcation since not only does the operating system have to allow app access to these lines, the JVM then has to let them thru to the Java app.
If you want to sense a button press, use a mouse or other input device intended for the purpose.
As I said, trying to detect a single voltage change with RS-232 is a kludge. What I neglected to mention is a simple way to do it within the RS-232 spec so the normal software interface will do what you want.
The simplest way is for a small microcontroller to detect the button closure and then emit a character to the serial port. This has the added benefit of allowing the micro to perform debouncing, which is something you should think about. If this is a one-off then get a small micro with a UART. Otherwise, you can use the smallest possible micro to clock out the character in firmare. This is really not hard, especially if you make the baud rate low enough. I once sent 9600 baud from a PIC 16 running from a 160 kHz crystal. You can easily do this with a PIC 10F200 running from its internal 4 MHz oscillator.
One problem is that the micro will be running at logic levels, whereas RS-232 requires the input signal to swing at least from -5V to +5V, preferably a bit more. The completely right way is to add a RS-232 interface chip like a MAX232 or similar. However, many PC COM ports work with only 0 to +5 input voltage swing. In that case, the micro can drive the PC's receive line directly. Keep in mind that in this configuration, the signal needs to be inverted from what normal micro UARTs put out. Line idle must be low, whereas the built-in UART will produce line idle high.