Article View: borland.public.jbuilder.java.swing
Article #8825Synchronizing components
From: Jean-Fran�ois Leroux
Date: Sun, 16 Jul 2000 00:00
Date: Sun, 16 Jul 2000 00:00
26 lines
1743 bytes
1743 bytes
Hi, Here's the summary - see the full story below if you're interested : I'd like to synchronize a JTree node selection and the caret position of a JTextPane (with a structured document). Do you have any idea of doing it (I thought about Positions, but it is not very elegant, nor easy). Here's the full story : I have two components : a JTree and a JTextPane. These two are loaded with a custom document (inherited from DefaultStyledDocument), loading its data model from a class that I created and called StructuredDocument (a class which contains the document structure - let's say something like a book, with 3 parts, 3 chapters, etc.) I'm trying and synchronize the display in the two views (tree and pane) : I'd like the caret (in the pane) to be set automatically at the correct position when clicking in the tree - for instance, I'd like the caret to be placed at the level "1.2.2" when clicking this node in the tree. I thought about defining Positions in my document model, so that a node selection would point towards a Position, and so on... Doesn't seem very elegant though... Would you have a better idea on doing so ? Many thanks in advance. Best regards. -- jfleroux@club-internet.fr
Technical Details
Message-ID:
<8ksugl$d7r6@bornews.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,3558a18d3c542944,start X-Google-Attributes: gid111d45,public From: "Jean-Fran�ois Leroux" <jfleroux@club-internet.fr> Subject: Synchronizing components Date: 2000/07/16 Message-ID: <8ksugl$d7r6@bornews.borland.com> X-Deja-AN: 647057354 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing