Text selection in a JTextArea


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Text selection in a JTextArea

Hybrid View

  1. #1
    Kit Guest

    Text selection in a JTextArea


    Hi,

    I am using a JTextArea to load a document, and I want to let users to select
    text, not by document flow, but by rows and columns (e.g. by dragging from
    the left-upper to the right-lower corner of a region) It would work kind
    of like a spreadsheet. Is such possible?

    Kit Hsu
    khsu@treev.com

  2. #2
    Paul Clapham Guest

    Re: Text selection in a JTextArea

    You'll notice that JTextArea's getSelectedText() method returns a String.
    Not an array of Strings, which is what you would need. Anyway, I don't
    understand how your proposal would work with a non-fixed-width font, where
    you don't have columns of letters.

    But of course the answer to your question is not "No". It's "Sure, go ahead
    and write a subclass of JTextArea that does what you want."

    PC2

    Kit <khsu@treev.com> wrote in message news:3a883801$1@news.devx.com...
    >
    > Hi,
    >
    > I am using a JTextArea to load a document, and I want to let users to

    select
    > text, not by document flow, but by rows and columns (e.g. by dragging from
    > the left-upper to the right-lower corner of a region) It would work kind
    > of like a spreadsheet. Is such possible?
    >
    > Kit Hsu
    > khsu@treev.com




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center