Hello everyone, I am very frustrated. I am trying to set my cursor at the beginning of the second line of my JTextArea but the cursor doesn't show when I uncomment the block of code in my JNotePad constructor, why?
myFile.txt has just one sentence that says, "This is a test of your local broadcast".
comment out the requestFocusInWindow() run the program again, just to make sure it's the same as before (no blinking cursor) make one slight change: //add(north, BorderLayout.NORTH); add(north, BorderLayout.SOUTH);//add buttons to bottom, instead run program again
If you want to ensure that a particular component gains the focus the first time a window is activated, you can call the requestFocusInWindow method on the component after the component has been realized, but before the frame is displayed.