Changing the mouse pointer in JtextPane

后端 未结 2 544
夕颜
夕颜 2021-01-21 00:05

I have a JTextPane which has the content type text/plain. I set some texts to that JTextPane and it contain some texts which display <

相关标签:
2条回答
  • 2021-01-21 00:32

    You could try this:

    pane.setCursor(new Cursor(Cursor.HAND_CURSOR));
    

    Where pane is your JTextPane.

    0 讨论(0)
  • 2021-01-21 00:41

    Did you read my answer in your posting on Adding tooltips to JTextPane?

    Well the concept is the same. You use a MouseListener and convert the mouse point to get the text at the caret position. When you are over a url text then you change the cursor.

    The Utilities class might help you access the text at the caret location.

    If you need more help then post your SSCCE that shows what you have tried and shows what problems you are having.

    0 讨论(0)
提交回复
热议问题