Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / October 2005

Tip: Looking for answers? Try searching our database.

JTextPane: unusual problem..

Thread view: 
Frances - 08 Oct 2005 19:03 GMT
I have this chat app window, top JTextPane is where incoming messages
from other chatters appear (standard chat window behavior..) prob is
that window 'refreshes' text every 30 seconds (to display incoming
messages), and b/c it refreshes every 30 seconds can't copy any selected
text from that JTextPane, i.e., can select text but selection doesn't
hold b/c that pane is constantly refreshing...  would appreciate any
ideas on how I could solve this problem.. thank you very much....
Roedy Green - 08 Oct 2005 22:58 GMT
> i.e., can select text but selection doesn't
>hold b/c that pane is constantly refreshing...

The brute force approach is when you click, that suppresses paints for
5 seconds. In paint you just compare now with last click. If less than
5000 ms, you just return.

The catch is the text representation is continuing to change, so your
visuals are out of date. Selecting will select the wrong text.

You actually need to suppress updates.  how about this.
Have two windows.  When the user clicks, you create a clone, and
continue letting it receive updates in the background.  When the user
has finished his thing or there is a timeout, you discard the front
window and replace it with the background one.

But that won't work if the user is updating the window. Because then
her changes will be lost.

So you need to buffer up the changes in some sort of FIFO queue while
she is busy using the screen.  See
http://mindprod.com/jgloss/queue.html

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.