Image in a label

hi, i have an image in a label and i need that;
when the mouse pass over the image of the label, this image change in another image, only when the mouse is over the image
how can i get this?
thanks

hi,
you need to use a mouselistener on the label.
import javax.swing.*;
import java.awt.event.*;
class LabelTest extends JFrame {
     JLabel label = new JLabel(new ImageIcon("add.gif"));
     public static void main(String args[]) {
          LabelTest lt = new LabelTest();
          lt.display();
     void display() {
          label.addMouseListener(new mouseListen());
          getContentPane().add(label);
          setSize(100,100);
          setVisible(true);
     class mouseListen extends MouseAdapter {
          public void mouseEntered(MouseEvent e) {
               label.setIcon(new ImageIcon("bordercolor.gif"));
          public void mouseExited(MouseEvent e) {
               label.setIcon(new ImageIcon("add.gif"));
}Just replace the image names with yours, it's not pretty but i hope it helps. when the mouse is placed over the label the mouseEntered method is invoked, use that to replace the image on the label, and when the mouse leaves the label the mouseExited it invoked use that to go back to the old image.

Similar Messages

  • How to clear image in sender label to print envelopes from Address Book

    Hello!
    I had been printing envelopes for greeting cards using Address Book. I had always ignored the "Image" option under "Label" for the +sender's information+. Today I decided to explore this option and clicked on "Set". Then I chose a picture from my "Pictures" folder. It looks nice and I was able to change the picture several times, but now _I do not want any "image" in the sender's label_.
    *How do reset the "Image" to none?*
    Thank you in advance for your assistance!
    Osk Asks

    Hello captfred! Thank you for your reply. I tried to do what you suggested but it seems that it only works for cards in my contacts or for my own card. My problem is within the settings under label when I am printing from Address Book.
    This is how I have been doing it:
    1) Select a contact or a group of contacts
    2) Click on File on the top of the screen and then select Print
    3) A window pops up and there I can choose whether I want to print an envelope, a list, or mailing labels
    4) In that same window is where I clicked on "Image" and "Set"
    5) Finally I click on "Print" on the bottom right corner and I get neat envelopes with my address (sender) and the recipients (my contacts)
    I hope this helps you to help me!
    Thanks in advance!
    Osk Asks

  • How to create a SelectItem with image before the label text?

    How to create SelectItems with image before the label text for selectMulitpleChoice, selectOneChoice, selectOrderShutltle, etc?

    you have to create a custom selectoechoice for this.. to have an image next to the seelct items..
    as mentioned above..
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/55-selectonechoicewithimages-170420.pdf

  • Is it possible to create an Image and a label below it?

    hiii,
    Is it possible in Java to create an Object with an image and a label.
    I means like icons in MS Windows.( ie : an Image and a label below it).
    If it possible please post the source code.
    Thanks in advance.
    Nikhil.K.R

    Go read the documentation and tutorial for JLabel.

  • Putting an image onto a Label

    Hi,
    does anybody know how to put an image in the Label class???
    bye

    try using a swing label JLabel
    jl = new JLabel("Text for your label",
    new ImageIcon("ImageForLabel.gif"), JLabel.CENTER);
    or how every you want to constrain the way the label will be painted
    gif or jpeg or what every is allowed
    must define jl etc. before
    import the javax.swing / java.awt etc. what evey you might need
    later
    walker

  • [b]Two images in a Label  [/b]     (foreground & background)

    I cannot add two images to a Label. just one is acceptable but I have to add two images in a Label or another idea that shows two images up and down (foreground & background). The foreground image is GIF so it is transparent and the background is JPEG ..
    Is there any idea or sample code for this? I couldnt managed for about 3 hours.
    Regards, Bulent TASTAN

    The easiest thing to do is combine the images into one image.
    import java.awt.*;
    import java.awt.geom.*;
    import java.awt.image.*;
    import java.io.*;
    import java.net.*;
    import javax.imageio.*;
    import javax.swing.*;
    public class Example {
        public static void main(String[] args) throws IOException {
            BufferedImage gosling = ImageIO.read(new URL("http://today.java.net/jag/bio/JagHeadshot-small.jpg"));
            BufferedImage duke = ImageIO.read(new URL("http://today.java.net/jag/old/green/duke/T4.gif"));
            Graphics2D g = gosling.createGraphics();
            double dx = (gosling.getWidth()-duke.getWidth())/2.0;
            double dy = gosling.getHeight()-duke.getHeight();
            AffineTransform xform = AffineTransform.getTranslateInstance(dx, dy);
            g.drawRenderedImage(duke, xform);
            g.dispose();
            JFrame f = new JFrame("Example");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(new JLabel(new ImageIcon(gosling)));
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • Radio group / Image issues: additional labels - how do I get rid of them?

    Hello experts,
    I'm having a little issue with a radio group in VC on SPS 11.
    The problem is that I need a radio group in a popup (not sure if that is relevant) - and I also can create this - but it creates a textfield (with a label that has the radio groups name as its text) as well, that is not shown during design time, but only after I deploy the model.
    The annoying textfield is always displayed at the lower left corner of the popup.
    How can I disable this?
    On a related note, I'm also having a similar issue with Images: for an Image with name IMG3 it also displays a textfield with a label 'IMGFLD3" that shows the resource that is currently displayed in the image.
    What can I do about this?
    Best regards,
    Florian

    Hi Srini,
    I used the following work around:
    Instead of using one image UI control that has many images in the Control Properties -> Image tab (all with their respective visibility condition), I used many image UI controls with just one image each (and visibility condition 'true'), stacked them on top of each other, and used the 'hidden' property of the image control instead to select which image is displayed
    Hope that helps, best regards,
    Florian

  • [CS3 JS] Get filename of image in a labelled frame

    Hi,
    I can easily get the content of a labelled text frame using
    var myString = app.documents[0].textFrames.item("myLabel").contents;
    Is is possible to get the name of an image placed into a similarly labelled graphic frame?
    One way I thought of doing this is to look at the parent frame of each link in the document and test to see if it is labelled "myLabel" and then get the name of the linked file.
    There must be a simpler way.
    simon Kemp

    You can create an array of all text frames labeled "myLabel" like this:
    myArray = app.documents[0].textFrames.item("myLabel").getElements()
    Then you can cycle through that array checking if an element has a graphics in it: if (myArray.graphics > 0)
    Peter

  • Address Book - how do I remove image when printing labels?

    Hi
    Just getting ready to print the Xmas card labels - thought i'd add an image in the Address Book 'Print' Dialogue - then changed my mind!!!
    Big mistake - there appears to be no (easy / obvious) way to remove the image!!!
    Any ideas please.
    Thanks

    I never could figure out how to do this via the GUI and had to resort to a bit of "trickery". i.e.:
    - quit the Address Book application.
    - in Finder, go to ~/Library/Preferences and double click
    on com.apple.AddressBook.plist ( or just type
    "open ~/Library/Preferences/com.apple.AddressBook.plist
    in a Terminal window
    - in the property list editor, delete the value for
    "ABImagePath" , which is under "0" in "ABCustomEnvelopeDefinitions"
    - save the file
    - quit the Property List Editor
    - start Address Book
    /cj
    various   Mac OS X (10.4.3)  
    various   Mac OS X (10.4.3)  
    various   Mac OS X (10.4.3)  
    various   Mac OS X (10.4.3)  

  • How can i add a jpeg image in a label of my frame !

    hi!
    i wana to add a jpeg image to my frame in a label !!
    can you please help em !
    thanks

    yourPicture is a jpeg in the same dierctory as the class where u add this code ....
    URL picURL1 = getClass().getResource("yourPicture.jpeg");
    ImageIcon icon = null;
    if(picURL1 != null)icon = new ImageIcon(picURL1);
    JLabel lblLogo = new JLabel(icon, JLabel.CENTER);

  • Double image when printing labels

    I am copying in a graphic for Avery round labels. Everything looks fine on the screen, but when printed, some (not all) of the labels have the image, plus a smaller version of the image on top of it. Kind of like an inset. I have reloaded the printer software (I have an HP Photosmart c8180 All in one), used old avery forms, downloaded new avery forms, and a host of meaninless other things.  Any suggestions would be most welcome.

    Hi, have you tried using another program to print the image?
    Please mark the post that solves your issue as "Accept as Solution".
    If my answer was helpful click the “Thumbs Up" on the left to say “Thanks”!
    I am not a HP employee.

  • How to add image to address labels

    I used to do this all the time, in the good old days. Now, I don't seem to be able to move a tiny clipart item into the area of a label. I can make the labels but no clipart makes it to the printing part. What am I forgetting???
    I was able to add same clipart into business card - but they gave me a square into which to drag that.
    I can get the clipart to appear in the original set up, but it doesn't copy into the list, nor does it show up in print out.
    I hope I am making sense.

    Hi Vicki,
    With the labels showing, press shift-command-L to go to Layout mode.
    Paste your image onto the layout, then size it to fit.
    Return to Browse mode by pressing shift-command-B.
    Regards,
    Barry

  • Display image with Logout label

    Hi,
    I am trying to create logout image&label as show on this page below at the right top corner,
    http://apex.oracle.com/pls/otn/f?p=31517:227:9400289793713::NO:::
    whenever i insert image in the Logout/Navigation Bar Entries the image .gif with style=width/height=16/16 doesnt show
    any idea on this...regards

    You're going to need to supply more information.
    Perhaps compare your generated HTML with what is found on Denes' page
    <a href="apex_authentication.logout?p_app_id=31517&p_session_id=16383870403475" style="text-align:center;display:block;">
    <img src="wwv_flow_file_mgr.get_file?p_security_group_id=2381609905666412890&p_fname=sign_out.gif" width="16" height="16">
    <br>Logout</a>Do you get any browser errors?
    Scott

  • Images with dynamic labels within: initial question

    Hi everybody,
    My question is simple (I am very new to Java2d); I want to open a image (JPG, BMP...), draw some simple text strings and messages on it and return it;
    could anybody recomend me a tutorial, a example or some documentation for doing this in a simple way?
    TIA,
    Daniel

    Hi.
    Try something like this:
    BufferedImage bufferedImage = ImageIO.read(new File("source.jpg"));
    Graphics2D graphics = (Graphics2D) bufferedImage.createGraphics();
    graphics.drawString("Hello in Image", 0, 0);
    return bufferedImage;For more primitives, check the docs of Graphics2D and Graphics classes.
    Hope this helps.

  • HI, I need to display an image in a Label

    how can i get that?

    Hi,
    JLabel label=new JLabel(new ImageIcon("myImage.gif"));Take a look at: http://java.sun.com/j2se/1.4.1/docs/api/javax/swing/JLabel.html

Maybe you are looking for

  • Unable to print a report- Server Error

    I have a java/CR XI (sp3) web application which will display reporters but will not print them. When attempting to print the Crystal report viewer page shows the print dialog page with a choice of printers. When I select a printer and press print. I

  • Filter in OBIEE 11G

    Hi, Could any one please guide me on how i can use Values from a Notepad/xls/csc etc as filter for my answers Reports. Requirement is to filter values in answers based upon a values(Customer_Id) locally saved notepad file in user Machine. Also below

  • CDHDR entries for chaning LFA1-LNRZA

    Hi, If I change any of the main fields of vendor data then there is one entry in CDHDR Even if I change multiple fields, eg I change name, city and bank data Then there is only entry in CDHDR and multiple entries in CDPOS for LFA1, LFBK tables etc bu

  • By using imessage to communicate with someone who lives in norway will the imessage charge as an international text message?

    if you use imessage to communicate to someone who lives in norway will it charge as an international text?

  • Table rows are breaking on seperate pages...

    I have table which has 20 rows: First 3 rows are on one page, then half of the page is blank hen remaining 17 rows are on second page. How can I keep table from breaking rows. I want all rows in table to follow one another. Please help. Thanks.