[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);
}

Similar Messages

  • Blend two images in CS4

    Hi, after taking two images of a landscape, one exposed for the foreground and another exposed for the sky. How do I open them each in a seperate layer so I can blend the two together. Giving me a correctly exposed image of foreground and sky. I dont want to do HDR just blend two images. I use CS4.
    I should mention I use Aperture to manage my images and edit with CS4 by migrating the image from within Aperture....Many thanks for any help......Gerry

    Thanks for replying
    When I open two images in CS4 then try to drag one of them into the other document, it just opens up the second image as a new seperate background...I can switch between the two, but theyre seperate. I'd like to open the second image in the same layer as the first so I can brush the correctly exposed sky onto the overexposed sky.
    Iv'e only used CS4 for editing images in the past so I am new to this technique of blending. My issue is I dont know how to open the two images I want to merge / blend ? so I can brush away the unwanted parts of the image....revealing the parts of the correctly exposed sky that I want to keep...
    A pointer to a tutorial would be appreciated...
    Hope I'm explaining myself ok
    Thenks ...Gerry

  • Text and two images in accordion header?????

    how to insert two images in the accordion header
    1) indicates the accordion image constant
    2) if the accordion's state is up or down.
    i tried using headerStyleName,
    <mx:Accordion     headerStyleName="customAccordionHeadStyles">
                <mx:headerRenderer>
                           <fx:Component>
                                 <mx:Button fontWeight="normal"
                                   disabledColor="#000000"
                                   labelPlacement="left"
                                   textAlign="left"
                                   />
                           </fx:Component>
                </mx:headerRenderer>
                 <mx:VBox label="Some text here    " paddingTop="0"
                         backgroundColor="#ebfaff" icon="@Embed('assets/goodIcon.png')"
                        // one more icon or skin state here to show it was up or down
                         verticalScrollPolicy="off"
                         horizontalScrollPolicy="off"
                        / >
                 <mx:VBox label="Some text here    " paddingTop="0"
                          backgroundColor="#ebfaff" icon="@Embed('assets/badIcon.png')"
                         // one more icon or skin state here to show it was up or down
                          verticalScrollPolicy="off"
                          horizontalScrollPolicy="off"
                          />
    </mx:Accordion>
    thanks for reading.

    You can use "CanvasButtonAccordionHeader" to make custom Accordion header  (HeaderRenderer) and add text/images as per your requirements.
        <mx:headerRenderer>
            <fx:Component>
                <components:HeaderRenderer  />
            </fx:Component>
        </mx:headerRenderer>
    One needs to add "flexlib.swc" to access "CanvasButtonAccordionHeader".
    Hope this helps!
    --Tanu

  • Mask out two selections in two images

    Here are two images, both are selection cut for emphasis.
    This first image, I blurred the top of the animal as I've successfully accomplished that goal.
    The bottom part of the animal is the difficult part, atleast in my case.  There is what appears to be another animal in the background ? You can see the foreground animals legs, I want to make a perfect selection, including hair.  For the top portion of the image I used color range and refine masked, worked well. 
    This second image I posted because I'm going to assume; that similar techniques made be used on both. I want to make out the two tufs of hair you see, including all the fine hair.  The techniques mentioned earlier were a bit frustrating to get to work, maybe it's my technique, there is also a shadow in the image which in my opinion may have hinder the technique I used ?

    I would suggest getting to know the quick mask tool.
    Here are some tutorials that should help you achieve your effect: http://tv.adobe.com/videos/refine-edge/

  • How do I use the move tool in CS5 to put two images on to an A4 sheet?

    Have recently upgraded from CS3 to CS5.
    I often print out two images on A4 paper.  Under CS3 I would simply adjust and crop 2 images to say 7 ins x 5 ins, after that bring up a new A4 sized sheet (file, new), then using the move tool I'd move the two separate images on to the A4 sheet and print.  Fine!
    Now under CS5, once I've adjusted my first image then try to bring up a second image to adjust that one I seem to lose the first one from the screen.  But on going back via Bridge and clicking on the image it re-appears - problem is, I lose the second image.
    When I bring up a new A4 sheet neither of the images stay on the screen and there is nothing to move.
    Have been into Preferences to see if there is anything there to help but can't see anything.
    Does anyone know what is happening here and what I'm doing wrong i.e. how do I get 2 separate images on to an A4 sheet?
    Thanks,
    Bob Eveleigh.

    There have been changes since cs3, mainly that cs5 uses tabs.
    Tabs can be confusing if your coming from cs3.
    If your in the tabbed mode, try going to Window>Arrange>Tile.
    All your open documents should be visible on the screen.
    If this is the cause of your frustrations, you can read more here:
    http://help.adobe.com/en_US/photoshop/cs/using/WS8599BC5C-3E44-406c-9288-C3B3BBEB5E88.html #WS6389D09B-91D5-4474-9AED-C52AE33356EB
    MTSTUNER

  • Two images at the same time

    Hi!
    I'm new into FCE and I would like to ask for some help. Can I work with two images at the same time? I mean, Can I superimpose two images to make one? How can I do it?
    Maybe this is something easy, but I'm just starting,
    thanks in advance for your answers
    Message was edited by: angelcotallo

    Yes, you can. You can put one clip on top of the other in the timeline. You can make both clips visible by reducing the opposite of the clip or top, or by scaling back the clips so they are smaller. You can reduce the opacity and scale of the clips in the viewer by opening the clips from the timeline into the viewer. You can also scale the images directly in the canvas when it is in Image+Wireframe mode.

  • 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.

  • How to combine two images in preview onto one page

    Sorry if this topic doesn't go here - there wasn't a "preview" category.
    I have two images that i want to print out on the same page and right now they are each on a separate page in the same file in preview. Does anyone know how I can combine them onto one page?
    Thanks
    Message was edited by: p-rock

    Hi -
    I load two images in Preview and select them.
    !http://www.spotsbeforeyoureyes.com/Preview1.jpg!
    Then I select Print Selected Images:
    !http://www.spotsbeforeyoureyes.com/Preview2.jpg!
    When the print dialog box opens, I select Images per Page:2
    !http://www.spotsbeforeyoureyes.com/Preview3.jpg!
    Hope this helps.
    MtD

  • IO - Read two image files and put them into one file

    Hi,
    i have 3 files in all. The two image files and one text file. I need to place the image in the first image file, followed by text in the text file and then the image in the second image file, into one file.
    Can anyone tell me how do i go about doing this ?
    i tried using fileinputstream and fileoutputstream, which works fine if all the 3 files have text but when the first and the third file have image, the code doesn't give any error but the result file displays only the image from the first file and nothing else.
    i am running short of time and need to do this really soon.
    if anyone has done anything like this. please let me know,
    thanx,
    poonam

    One approach would be to programmatcally create a single zip/jar file from the three input files. You can use the java.util.zip and java.util.jar packages for this purpose.
    The other apprach would be to create a single image by drawing images and text strings on a BufferedImage object.
    I think the first approach is preferable because you can easily extract the individual files from the zip/jar file

  • Two images on a page, want to number each image.  How?

    Page layout with two images on a page, other pages have one image.  I want to have a number associated with each image.  I tried page numbering to no avail.  How do I have a sequence number for each image?
    I further complicate this; I will make many documents, each document will have about five pages, as I progress, I want the photo numbers to function likek page numbers, across all the documents. 
    How do I accomplish this?
    Rob

    Thank you, I am closer to the solution after following your instructions. On the Master pages (Two page spread), I made a text frame adjacent to each of two frames for the images (There will be two images on each document page, thus two frames on each Master Page).  They are threaded together and I verified this by View > Show Text Threads.
    Since I am not getting the right result, I must have done something wrong.  I made numbered List using Paragrach Styles.  I could not find "text attribubutes" so I am probably not doing this right.  Please note that I have spent 7 hours on this so far, so I am making an effort. 
    It seems reasonable that this should be done on a Master layout, is this right?  So far, the text frame number flow from 1 to 4 across the the Master Page spread.  Thus the first two pages are correct.  However, when page is added based on the Master it repeats the same flow: 1 though 4.  I expect this because that's what the Master shows,  However, I want the numbers to continue as I add photos to additional pages.
    Thank you for any additional information you are willing to provide. 

  • Re: How to Join two images

    Do you want to side by side the images so one is on the left and the other on the right? If so just make them the appropriate size and copy them to the correct locations.
    If you want to overlay on onto the other then xor them.

    i have tried following code but it gives me image of 2 strips
    public static void joinImage()throws Exception{
              //loads two images with ImageIO
              //for testing purpose both header and content image are same
              BufferedImage imageHeader=ImageIO.read(new File("/home/g.pol/images/DSC04249.JPG"));
              System.out.println(""+imageHeader.getHeight()+" "+imageHeader.getWidth());
         BufferedImage imageContent=ImageIO.read(new File("/home/g.pol/images/DSC04249.JPG"));
         //create new BufferedImage instance of same width and height as that of merging images
         BufferedImage resultantImage=new BufferedImage(imageHeader.getWidth(),imageHeader.getHeight()*2,BufferedImage.TYPE_INT_ARGB);
         //get graphichs of resultant image
         Graphics resultantGraphics=resultantImage.getGraphics();
         //draw image on graphics with width is same as that of test images but height 1/2 of test image
         resultantGraphics.drawImage(imageHeader,0,0,null);
         resultantGraphics.drawImage(imageContent,0,50,null);
         ImageIO.write(resultantImage,"jpg",new File("/home/g.pol/images/result.JPG"));
         System.out.println("success");
         }

  • Is it possible to paste two images into one layer?

    I'm having some issues pasting two images into one layer. Every time I paste the second image, it automatically creates a new layer...is there anyway to prevent that from happening? I'm making an animation on photoshop and I want there to be more than image in some of the frames. Please let me know if you have any suggestions! Thanks!

    You can merge the two layers together once they're position. Select the top layer and choose merge down or select both and choose merge layers (from the layers menu).
    http://help.adobe.com/en_US/Photoshop/11.0/WSfd1234e1c4b69f30ea53e41001031ab64-78b2a.html

  • Recommended distortion method for matching two images

    I have two images of North America as separate layers that I'm trying to line up as closely as possible. One is a color image of the earth's surface while the other is a grayscale image representing the topography of the terrain. There are many obvious visual features in the images to use for matching, but I'm not sure what is the best tool or workflow for distorting, scaling, skewing, etc. I have previously been using "Warp," but while I can line up certain areas easily, other areas appear quite difficult to line up. I'm wishing there was a way to define "features" that I want matched up and then let Photoshop do an automated process, but I think that may be asking a little much. Because the images may have been taken from different angles, it's not just a simple non-proportional scale problem. Some areas need to be squished while other areas need to be stretched. Any suggestions?

    If the two maps are from different sources or different times, or have been created using different map projections, or if the two maps have different levels of accuracy, you may not be able to get a perfect match-up.
    Neil

  • Why I can't subtract two images in imaq vision builder?

    Hi,
    I have many times tried but failed to get the objects in a image by subtraction with another image which is background, in imaq vision builder(ver. 6.0). I totally can't use the "operators" command under "greyscale" to subtract the two images becauee all commands under the "greyscale" are always unactivated after two images have been stored in 2 idfferent buffers. I really don't know why and this vision builder is so difficult to use, unbelievable! I followed the instructions in its Help and it's quite simple but I totally failed to make this operation!
    Two samples of images have been attached and maybe it's very ease for you to filter out objects(fibers) by subtraction each other. Show me your scrip
    t if you can. It's urgent to me.
    Or the idea of the way I thought for filtering the objects is wrong? Point out please if you know.
    Thanks and Merry Christmas and Happy New year!!
    Swedlin
    Attachments:
    10Img0.jpg ‏27 KB
    123Img0.jpg ‏25 KB

    Okay, this is not quite as straightforward as it could be, but you can do image subtraction in Vision Builder. The basic idea is as follows:
    - select first object image and copy it to buffer 1
    - select "image >> get new image" and load your background image from a file.
    - put this in buffer 2
    - retrieve object image from buffer 1
    - perform subtraction. Even though these images appear to be greyscale, they are actually saved as 24-bit RGB images, so you need to use the color operators instead. Vision Builder will only allow you to select steps that are valid for the image you have loaded. You could extract the luminance plane from all of your images to work with 8-bit images if you like.
    I have attached below a background image, several object i
    mages, my script, and the results of batch processing. You will need to edit the "get new image" step with the correct path to the background image on your machine.
    Bruce is right though. This is a bit easier in LabVIEW.
    Regards,
    Brent R.
    Applications Engineer
    National Instruments

  • SuperImpose two images and save it as a single image[urgent]

    Hello..
    Can anyone tell me how do we superimpose two images and save it as a single image.The image on the top is smaller in size in my case.
    Please Help..

    import java.awt.Graphics2D;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    class TwoBecomeOne {
        public static void main(String[] args) throws IOException {
            BufferedImage large = ImageIO.read(new File("images/tiger.jpg"));
            BufferedImage small = ImageIO.read(new File("images/bclynx.jpg"));
            int w = large.getWidth();
            int h = large.getHeight();
            int type = BufferedImage.TYPE_INT_RGB;
            BufferedImage image = new BufferedImage(w, h, type);
            Graphics2D g2 = image.createGraphics();
            g2.drawImage(large, 0, 0, null);
            g2.drawImage(small, 10, 10, null);
            g2.dispose();
            ImageIO.write(image, "jpg", new File("twoInOne.jpg"));
            JOptionPane.showMessageDialog(null, new ImageIcon(image), "",
                                          JOptionPane.PLAIN_MESSAGE);
    }

Maybe you are looking for

  • Error in Message Status in SAPBC

    Hi All: We are using SAPBC as our middleware for communication between SAP and external billing application. We are trying to send PO in the form of IDocs (ORDERS) from SAP to the external application through SAPBC. The message type ORDERS in SAPBC h

  • SQ01 with Time Stamp Fields

    Hi, If I have Time Stamp Fields in my Query, is it possible to format these fields into having just the date (both in the selection screen as well as in the output list)? Rgds, /Fredrik.

  • Help on stuttering video after FMS call Stream.get('liveBroadcastStream').play('liveFeedFromFMLE', -

    Hi, We recently encountered a very strange issue that we urgently need help: With FMS 3.5, we created a new live application according to relevant documentations. Within this application (main.asc), on periodically basis (e.g. 45 seconds), we use Str

  • JDBC Insert

    hi folks, I have a oracle table with USER_ID as primary key. Using JDBC i m trying to insert a row with same USER_ID and hence violating primary key rule. try { stat.executeUpdate(SQL); catch(SQLException ex) Now JDBC throws me a sql Exception, with

  • Firefox no longer installed, but I did not uninstall it.

    I started my XP machine today and Firefox was gone. No sign of it, no Mozilla folder, not listed in add/remove programs. I have no idea what happened to it. I can download and reinstall, but want to know how it got removed.