Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #35658
| From | Martin Gregorie <martin@address-in-sig.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: JTextArea |
| Date | 2016-09-27 14:44 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <nse0ke$ts8$1@dont-email.me> (permalink) |
| References | <76597439-1bdd-4674-bbc2-771e593ab06e@googlegroups.com> <a8e9f052-b06c-413b-886a-5ccb52089227@googlegroups.com> |
On Tue, 27 Sep 2016 05:19:37 -0700, Eric Douglas wrote: > On Tuesday, September 27, 2016 at 8:13:40 AM UTC-4, Eric Douglas wrote: >> Am I missing something? >> I'm trying to use this control but if I select text then I click in the >> middle of the text it un-highlights. I should be able to click in the >> highlighted text to drag it elsewhere. Why does it immediately >> un-highlight on mouse down and how do I fix it? > Probably because JTextArea is primarily intended for displaying text and allowing parts of it to be copied to other windows. Yes, a JTextArea can be used to enter text provided that the instance has been set editable (the default) but its not really intended for editing text: if that's what you want, you're better off using a JEditPane instance and doing clever things with the caret and the action listeners as needed. FWIW some time back I built a 24x80 green screen terminal emulator round a JTextArea instance with its colours and font set appropriately. I handled both keyboard input and text display by setting editable and wordwrap to false, linewrap to true and using a KeyAdaptor together with the JTextArea text manipulation methods to accept and display keyboard input and sending it to the host computer. JTextArea text manipulation methods were also used to display host computer responses on the screen. That was fairly easy to implement and ran happily at 9600 baud, the normal linespeed of the host computer. This emulator was developed and tested on a 480 MHz Thinkpad laptop using Java 1.4 and running Linux. Before you ask, the terminal emulator used a standard network connection to talk to a serial port handler, which was written in C, and which handled the host connection. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
JTextArea Eric Douglas <e.d.programmer@gmail.com> - 2016-09-27 05:11 -0700
Re: JTextArea Eric Douglas <e.d.programmer@gmail.com> - 2016-09-27 05:19 -0700
Re: JTextArea Martin Gregorie <martin@address-in-sig.invalid> - 2016-09-27 14:44 +0000
Re: JTextArea Eric Douglas <e.d.programmer@gmail.com> - 2016-09-27 08:28 -0700
Re: JTextArea Martin Gregorie <martin@address-in-sig.invalid> - 2016-09-27 17:44 +0000
Re: JTextArea Eric Douglas <e.d.programmer@gmail.com> - 2016-09-27 14:00 -0700
csiph-web