This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Lookup functionality in JEditorPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Lookup functionality in JEditorPane" Watch "Lookup functionality in JEditorPane" New topic

Lookup functionality in JEditorPane

Mahesh Kedari
Ranch Hand

Joined: Nov 28, 2009
Posts: 111
I wanted to design a text editor using JEditorPane with hint functionality.
It should display hints, the way IDEs (netbeans, eclipse) show the hint for code.

I am not sure if JEditorPane is a good choice for this requirement. I tried to google it, but didnt a good result.
Can anyone please suggest an approach or any link which will explain this functionaliy?

Mahesh Kedari - Fidus Technologies Ltd.
Rob Spoor

Joined: Oct 27, 2005
Posts: 19556

Do you mean a tool tip? If so, JComponent has two methods called getToolTipText. One of those takes a MouseEvent from which you can determine where the tooltip should be displayed. Subclass JEditorPane to override this method.

How To Ask Questions How To Answer Questions
Mahesh Kedari
Ranch Hand

Joined: Nov 28, 2009
Posts: 111
Thanks a lot Rob for response.
Rob, I am not sure if its a tooltip component.
I am talking about the hint list which come in most of the IDEs when we type some text in its editor. We get a list of choice starting with the text we have entered.
This hint list is displayed irrespective of any mouse event.
I agree. Here's the link:
subject: Lookup functionality in JEditorPane
Similar Threads
need some advises on JEditorPane
JEditorPane Problem ...
JavaHelp question
Multi Color-Font in JEditorPane
how to activate html-links in a JEditor pane