How to control keyboard focus?

The following code is not working the way I want.
These are the requirements:
1. the top area (JTextPane, light gray in color) is user typing area.
It has the keyboard focus all the time. It only should receive letters, not any numbers.

2. the bottom area (JTextArea, gray in color) is for ONLY display numbers recevied either
from keypad (0-9 and + -) or from the top of keyboard (0-9). It NEVER has focus on it.
So user should never be able to type on this area.

Here is an example:
I type in the top area the text as this: This is my phone number : 123-456-7890.
"This is my phone number :" should be shown on the top area.
"123-456-7890" should NOT be shown on top area, it should be diplayed on bottom area.

What we get now is a mirroring of keyboard entries between displayArea and typingArea. What's required next is
a routine that will take keyboard inputs and (to start with) display non-numeric characters in typingArea and numerics in
displayArea. What to do with the other characters (+, -, *, etc.) is unclear to me--do you wish them displayed in both
jTextAreas or only in the lower displayArea?

I tried your code. I see the mirroring effect. I didn't give much detail of the requirement. In fact, 99% times, user types non-numeric on the typingArea and types a lot. If it is an efficient to mirror keyboard entries in this case?
Other characters like (+, -, *) from keypad will be shown "displayArea" too, not shown on "typingArea".

Frustratingly, the displayArea will not take any Alphas, but neither will it take numerals from the top of keyboard (only the number pad at right). Also
the typingArea will take numerals--one only if from above the keyboard, and endless amounts if from number pad. Here is the code with the custom Document:

I'm also going to include another modified verison of your original class in which I tried to control everything from the keyPressed method. In it, although I can control the lower displayArea just fine, it seems impossible to auto-remove numerics from the top typingArea:

I simplified the code changed by edwardiii. The problem is still there, which can't remove numerics from the top typingArea, although I add event.consume() to consume them. (BTW, I don't need process the numbers from the top of keyboard differently, only keys from keypad will be displayed in the "displayArea").

I was able to get my previous code to work by adding code to the keyReleased event. I created a new int variable "keyedType"; if any type of numeric was entered then keyedType was set equal to 1,2, or 3, but if an Alpha was input then keyedType was set = 4. In the keyReleased event I then entered:

I tried your latest code. I see how it works. It is getting closer to work. However, there are two problems. One is when I hold a key of keypad,( e.g. I hold the NUMPAD 7) the typingArea and displayArea both will show serveral '7's. Another one is each time I type a number key, the typingArea shows on the number first and then was eaten/removed when the key is released, just the way as you coded.

The actual requriement is that the typingArea should not see the key input from keypad. So I think the keyevent from keypad should be consumed when the key is pressed and typed, not keyReleased. My 'event.consume()' doesn't consume the keyevent from keypad. Do you have any idea how to get it work? Thanks.

You are right:) I tried putting the event.consume() in the keyTyped event, and it seems to do everything you're looking for, including forcing the top typingArea to ignore any numerals, whether input via single-clicks or by holding down a numeral key:) Here is the revised code:

How to fix incompatible JVM issue while installing Eclipse
While installing Eclipse in windows, got one error like above and unable to proceed with the installation.
This video describes how to successfully install Eclipse.
How to solve incompa…