Displaying a "floating" JLabel at the caret position

cyberiapc_at_gmail.com
Date: 01/30/05


Date: 30 Jan 2005 02:55:30 -0800

Hi everyone,

I've got a JTextArea that serves as a very basic XSLT editor. One of
its functions is to allow the user to input elements via accelarators
(e.g. Ctrl+Shift+t inserts a <xsl:template> element). Is it possible to
display a component, such as a JLabel, at the position of the caret in
the JTextArea? The intention is to populate it with information about
what letter inserts what element)

Because my JFrame's LayoutManager is set to BorderLayout, I don't see
how I'd be able to position the JLabel at specific x,y coordinates
relative to the caret.

Thanks for any pointers.



Relevant Pages

  • Re: Displaying a "floating" JLabel at the caret position
    ... > I've got a JTextArea that serves as a very basic XSLT editor. ... > how I'd be able to position the JLabel at specific x,y coordinates ... > relative to the caret. ... Tooltips can be generated dynamically by overriding String ...
    (comp.lang.java.gui)
  • Re: JLabel Text Wrap
    ... I would use JTextArea instead of JLabel, ... display an image with the text, which to my knowledge JTextArea cannot ... text to wrap, and I would prefer to not dynamically insert tags. ...
    (comp.lang.java.gui)
  • Displaying multi-line text
    ... I want to display text on the screen, I would normally use a JLabel but I ... want this text to span over about 3 lines. ... I am trying to use a JTextArea ...
    (comp.lang.java.gui)
  • Re: Help to position JLabel with text top-right
    ... >My problem is with the text (on JLabel) to the left of the JTextArea. ... You can control the positioning of your JLabel with the layout. ...
    (comp.lang.java.gui)
  • Re: Can I get the current row from JTextArea
    ... > Is there a way of getting the current row that the caret is on in a ... > JTextArea? ... getCaretPosition(), getLineOfOffset() ...
    (comp.lang.java.gui)