0

I made a jTable of users. What I wanna do is, to show user's photo near the cursor, on click event of row. (I mean I want to show something like tooltip) Is that possible and how can I do it? Like this.but my app is desktop application http://rndnext.blogspot.com/2009/02/jquery-ajax-tooltip.html picture will be shown near the picture

mKorbel
  • 109,525
  • 20
  • 134
  • 319

1 Answers1

2

1) Google. 2) http://www.roseindia.net/java/example/java/swing/ImageToolTip.shtml

import javax.swing.*;
import javax.swing.text.html.*;
import java.awt.*;
import java.awt.event.*;

public class ImageToolTip {
    public static void main(String[] args) {
        JFrame frame = new JFrame("Image Tool Tip Frame");
        JComponent button = new JButton("Cut");
        String tooltiptext = "<html>" + "This is the " + "<img src=\"file:cut.gif\">" + " tool tip text." + "</html>";
        button.setToolTipText(tooltiptext);
        JPanel panel = new JPanel();
        panel.add(button);
        frame.add(panel, BorderLayout.CENTER);
        frame.setSize(400, 400);
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}
jpalm
  • 2,297
  • 1
  • 21
  • 27