• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 349
  • Last Modified:

How to show some text when you hover over a text in a Java GUI?

I ma working on a UI and I try to create a feature that will help me to view some text when I hover over some text.

I currently can create the rest of the view except this hover over feature.

Can you please help me how to create this feature in Java?

The example view is in the attachment.

2 Solutions
TolgarAuthor Commented:
I use tooltip but this time time I need to populate the text in another place. In the example that I sent, the information that I want to see is on the right handside of the window.

How can I do that?
mccarlIT Business Systems Analyst / Software DeveloperCommented:
Since you haven't posted code (and since I don't really do SWT) here is just a brief pseudocode outline of what to do. You can work out how to integrate this into your code...
Tree tree;    // Assume a Tree object gets created somewhere and is assigned to this "tree" variable

tree.addMouseTrackListener(new MouseTrackAdapter() {
    public void mouseHover(MouseEvent e) {
        TreeItem treeItem = tree.getItem(new Point(e.x, e.y));
         // you can now populate the area to the right of screen with details based on "treeItem"
         //    which will be the item that is hovered over

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now