-2

So I have a program that runs similar to MS-DOS did back in the day. Like MS-DOS I don't want a mouse or caret in my window.

So far I've managed to hide the cursor and the caret by making them both invisible, however you can still move and select other things on the screen.

So I have two questions:

  1. How do I completely remove the cursor or cancel any movement of the cursor?
  2. How can I make the caret always stay in one JTextField?

Thanks in advance :)

Kezz
  • 1,680
  • 3
  • 19
  • 37
  • 2
    If you look at other posts on this sites, the clear majority of users posted also their OWN code. Why don't you do that not? – Reporter Nov 13 '12 at 09:27
  • 2
    *"..have a program that runs similar to MS-DOS did back in the day."* Why would you want to make such a 'retro' app.? And if you want that look, why not launch and interact with it from the *actual* command line of that system? Just curious. – Andrew Thompson Nov 13 '12 at 09:35
  • 1
    no idea how do that (lock Caret) , nor for unknow GUI – mKorbel Nov 13 '12 at 09:38
  • 2
    1) *How can I make the caret always stay in one `JTextField`* why on earth would you have multiple *editable* `JTextField`s and want the carat to remain in only 1 `JtextField`? 2) *How do I completely remove the cursor or cancel any movement of the cursor* by cursour do you mean the Mouse cursor? if so see [here](http://stackoverflow.com/questions/1984071/how-to-hide-cursor-in-a-swing-application) – David Kroukamp Nov 13 '12 at 09:53

1 Answers1

4

Crazy idea to implement the behaviour but

  1. You can try to imitate this creating fully transparent image and set it as cursor.
  2. To let caret stay in just one JTextField just add just one JTextField:-). All the rest add as JLabels with borders.

Alternatively you can use JTextArea with black background and monospaced font.

StanislavL
  • 56,971
  • 9
  • 68
  • 98