Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Document/Element question (for extreme Swing gurus)



Sorry, another non-Mac-specific question--this is the only java list I'm aware of that has people
of the caliber to answer these questions :-). Please let me know if general questions such as
these offend.

Anyway, I'm trying to build an Element type for use with text panes, that permit "fields", i.e.
one could place two fields side by side, but they would still have a concept of a difference
between them; text would be entered into either one field or the other, depending on the
location of the cursor.

In order for this to work, my element spans have to work slightly differently than those
described in the Swing docs I've read. For example, all of the elements I've seen
described for use with JTextPane are "adjacent", in that the end offset of one element
is the same as the start offset of the next element. That is, elements have spans like
so:

[a,b],[b,c],[c,d]...

However, if I want each element to represent a field, and want to ensure that the cursor
is unambiguously in only one field, I need to have a separation between elements:
[a,b],[b+1,c],[c+1,d]...
because otherwise I could not (for example) determine if a cursor at position c was in the
second or third field element.

Now the question; can I do this, or does the Swing code expect that elements share endpoints?
I can always fudge, of course, by inserting "dummy" elements, but that would both be
inelegant and probably cause a lot more work.

Thanks,
Ken
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.