Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials:
 

Software Solutions and Services
 

 
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments
 
Showing an image in Tool Tip 
 

This section illustrates how to show an image in tool tip. One example is given below for illustration.

 

Showing an image in Tool Tip

                         

This section illustrates how to show an image in tool tip. One example is given below for illustration.

This program shows a command button. When you move the mouse pointer around the button then a tool tip text will be seen with an image. Through the help of this example you can easily attach an image with the tool tip text.

Screen shot for the result of the given program:

Image Tooltip Text for a button

In this program, some html tags are using for showing the tool tip text with an image. These html tags are understood by using HTML class from the javax.swing.text.html.*; package of Java Swing. Here tooltiptext is the string variable which contains several text. Html tags are also included. This code uses the <img> tag of html which calls the image which has to be shown with the tool tip text.

Here is the code of the program:

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(400400);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
}

Download this example.

                         

» View all related tutorials
Related Tags: c memory image class images interface io colors sed color get implementation display icon height value source width int id

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

3 comments so far (
post your own) View All Comments Latest 10 Comments:

can you give better code on menus

Posted by rolly on Thursday, 09.18.08 @ 09:03am | #80237

This is really a very nice piece of code.

Posted by Abhishek on Wednesday, 04.23.08 @ 19:19pm | #57708

send releted programs

Posted by palani on Monday, 03.3.08 @ 15:02pm | #51142

Training Courses
Tell A Friend
Your Friend Name
Website Designing Services
 
Web Designing Packages From $150!
 
Website Designing Company Web Hosting
 
Website Designing Quotation
 
Search Tutorials:

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.