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.

Similar Messages

  • Is it possible to create a thread and run it in background in nokia ??

    Is it possible to create a thread and run it in background in nokia series 40 mobile phones using j2me ??

    Probably a good question for ForumNokia. If you mean start up a thread and run in the background while your MIDlet UI does other things, then sure, why not. If you mean that you want to exit your MIDlet, but leave a thread running in the background, then I don't believe you can do this on series 40. S60 is another story since it supports multiple tasks.

  • Is it possible to create a playlist and share it with another itunes user?

    Is it possible to create a playlist and share it with another itunes user?

    try this out
    Select distinct   
    v_R_System.Netbios_Name0 AS [Computer Name],  
    v_GS_COMPUTER_SYSTEM.UserName0 AS [User Name]
     from v_R_System
    left join v_GS_COMPUTER_SYSTEM on (v_GS_COMPUTER_SYSTEM.ResourceID = v_R_System.ResourceID) 
    inner join v_fullcollectionmembership as b on (b.ResourceID = v_R_System.ResourceID) 
    left join v_GS_SYSTEM_CONSOLE_USAGE_MAXGROUP ON v_GS_SYSTEM_CONSOLE_USAGE_MAXGROUP.ResourceID = v_R_System.ResourceID
            inner join v_GS_SYSTEM e on e.resourceid = b.resourceid
     Where
    b.CollectionID = @collectionid
    Blog: http://theinfraguys.com
    Follow me at Facebook
    The Infra Guys Facebook Page
    Please remember to click Mark as Answer on the answer if it helps you in anyway

  • Trying to create an image and save it on file system

    Hi,
    I'm trying to create an image and save it in the file system :
         public static void main(String[] args) {
         int wid = 632;
         int hgt = 864;
         BufferedImage bufferedImage = new BufferedImage(wid,hgt,BufferedImage.TYPE_INT_RGB);
         bufferedImage.getGraphics().setColor(Color.black);
         bufferedImage.getGraphics().drawOval(30, 30, 100, 100);
              bufferedImage.getGraphics().drawString("test me one two three",2,2);
              bufferedImage.flush();
    try {
                   ImageIO.write(bufferedImage,".bmp",new File("C:/MyImage.bmp"));
         } catch (IOException e) {               
                   e.printStackTrace();
    THE PROBLEM : It creates C:/MyImage.bmp on my file system, but the file is empty (size 0).
    Am I missing something ?
    Thanks

    Try changing ".bmp" to "bmp". If that fails, try posting an SSCCE.
    Edit 1:
    And in future, please use the code tags when posting code, code snippets, HTML/XML or input/output. To do that, select the code and click the CODE button seen on the Plain Text tab of the message posting form.
    Edited by: AndrewThompson64 on Aug 3, 2009 1:23 AM

  • Class casting, creating an image and decompiling...

    Hi, I've got a couple of questions:
    1)
    How can I fully decompile classes, so with the implementation of the methods? Is it always possible to fully decompile a class file? When is it and when not?
    2)
    I aks this questions before, but I still haven't got it working, so sorry, but I ask it again :) :
    I want to create my own class, for example cMyClass which extends the java.awt.Image class, which has abstract methods. How do these methods(for example getGraphics etc) have to be implemented?
    3)
    I can't cast a Image to cMyClass... why not?
    Someone told me he did the following:
    Canvas c = new Canvas()
    cMyClass oImage = (cMyClass) c.createImage (100, 100);
    and that this worked... I tried to do this too, and it seemed to work, but it actually didn't!!
    I found out that c.createImage returns a null reference!!! That's why Java was able to cast it to my own cMyClass (not a problem to cast a null to something else), but when I created a Image (by doing a lot of unnessacary difficult stuff), and then tried to cast this Image to cMyClass it throw a ClassCastException or something like that...
    How can I cast the java.awt.Image class to my class anyway?
    3)
    Why can't you create a image like i've done above or even like below:
    Canvas c = new Canvas()
    Image oImage = c.createImage (100, 100);
    Why does this return a null reference?
    Isn't there a better way to create an image?
    4)
    The getWidth and getHeight need a I thought observer...? Why is this? I just want the width and height and don't have an observer or something like that. Is there a way around this?
    I tried getWidth(null) but this returns -1
    Please help! :)

    Hi, I've got a couple of questions:
    1)
    How can I fully decompile classes, so with the
    implementation of the methods? Is it always possible
    to fully decompile a class file? When is it and when
    not?You can always get a dump of the bytecode with 'javap -c'. If you don't want to figure things out yourself, try searching google for a class file decompiler, possibly a de-obfuscator.
    De-compilation is completely possible if the original author wanted that, by including debugging information. Depending on the degree of such information and the amount of code obfuscation, the decompiled code may lack variable names, line numbers, field and method names, class names, and even code structure. Names and line numbers are usually not re-creatable automatically, since the information is simply lost, but you can replace them with your own strings when analyzing an unknown class file (using the correct tools). Re-creating the original code structure may work in some cases, but to me the general case looks rather close to the halt problem (i.e. not solvable).
    Use a de-obfuscator, hope you've got good luck, and analyze the bytecode manually if that doesn't work.
    2)
    I aks this questions before, but I still haven't got
    it working, so sorry, but I ask it again :) :
    I want to create my own class, for example cMyClass
    which extends the java.awt.Image class, which has
    abstract methods. How do these methods(for example
    getGraphics etc) have to be implemented?I don't really understand the problem. 'abstract' means on the language level that your subclass must provide an implementation, i.e. a method body. What that method is expected to do is explained in the javadocs for Image. But in fact you're free to do anything. You could play a sound in the getWidth() method (replace with any method name if you want). Just consider the fact that a lot of code calls getWidth in the hope of getting the width of the image, not playing a sound. So much about the language level.
    On a higher level, a subclass of Image should implement a certain way to describe an image. AFAIK this means that your code must know the size of the image and know how to produce the pixels of the image. I can't tell you in general how you must do this, because it depends on your special case. This boils down to the question, why do you want to write a subclass of 'Image'? What new way of describing and image have you come up with?
    3)
    I can't cast a Image to cMyClass... why not?Simple, and that's certainly not an ALT. Because that specific Image is not a cMyClass. It's probably a BufferedImage or similar that was produced by AWT.
    Please read the specs carefully what casting is about.
    Someone told me he did the following:
    Canvas c = new Canvas()
    cMyClass oImage = (cMyClass) c.createImage (100,
    100);
    and that this worked... I tried to do this too, and it
    seemed to work, but it actually didn't!!
    I found out that c.createImage returns a null
    reference!!! That's why Java was able to cast it to my
    own cMyClass (not a problem to cast a null to
    something else), but when I created a Image (by doing
    a lot of unnessacary difficult stuff), and then tried
    to cast this Image to cMyClass it throw a
    ClassCastException or something like that...
    How can I cast the java.awt.Image class to my class
    anyway?You can't, and if you understood casting then you'd understand that it wouldn't make sense.
    3, 4(don't know)
    Maybe stupid question, but for example the BufferedImage, is this
    completly written in Java?
    How is the link made between the OS+hardware and the Java code? I
    mean, displaying images etc. is very platform dependend not?Look for JNI (Java Native Interface). It's a way to link native (e.g. C) code with Java code.

  • Creating thumbnail images and storing it as gif or jpg

    Hi all,
    Iam new to this forum. I need a solution for the problem iam facing in building my site. I have groups and briefcase section in my site. I allow users to upload files and pictures.
    When they upload pictures i need to create thumbnail for them and store them as gif or jpeg.
    It would be very greatful if i can get an early answer.
    Please let me know if there is any other forum where i can get better answer, if not here?
    thnx

    I found the following searching through the forum, under jpeg or thumbnail, a while back -- maybe you can use it:
    import java.awt.Image;
    import java.awt.Graphics2D;
    import java.awt.geom.AffineTransform;
    import java.awt.image.BufferedImage;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.io.FileOutputStream;
    import javax.swing.ImageIcon;
    import com.sun.image.codec.jpeg.JPEGCodec;
    import com.sun.image.codec.jpeg.JPEGImageEncoder;
    class Thumbnail {
    public static void main(String[] args) {
    createThumbnail(args[0], args[1], Integer.parseInt(args[2]));
    * Reads an image in a file and creates a thumbnail in another file.
    * @param orig The name of image file.
    * @param thumb The name of thumbnail file. Will be created if necessary.
    * @param maxDim The width and height of the thumbnail must
    * be maxDim pixels or less.
    public static void createThumbnail(String orig, String thumb, int maxDim) {
    try {
    // Get the image from a file.
    Image inImage = new ImageIcon(orig).getImage();
    // Determine the scale.
    double scale = (double)maxDim/(double)inImage.getHeight(null);
    if (inImage.getWidth(null) > inImage.getHeight(null)) {
    scale = (double)maxDim/(double)inImage.getWidth(null);
    // Determine size of new image. One of them
    // should equal maxDim.
    int scaledW = (int)(scale*inImage.getWidth(null));
    int scaledH = (int)(scale*inImage.getHeight(null));
    // Create an image buffer in which to paint on.
    BufferedImage outImage = new BufferedImage(scaledW, scaledH,
    BufferedImage.TYPE_INT_RGB);
    // Set the scale.
    AffineTransform tx = new AffineTransform();
    // If the image is smaller than the desired image size,
    // don't bother scaling.
    if (scale < 1.0d) {
    tx.scale(scale, scale);
    // Paint image.
    Graphics2D g2d = outImage.createGraphics();
    g2d.drawImage(inImage, tx, null);
    g2d.dispose();
    // JPEG-encode the image and write to file.
    OutputStream os = new FileOutputStream(thumb);
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(os);
    encoder.encode(outImage);
    os.close();
    } catch (IOException e) {
    e.printStackTrace();
    System.exit(0);
    V.V.

  • To group images with created text frame and apply label for it...

    Hi Everyone,
    We are currently working in auto figure placements for CS3. I have placing the figures into the document. Then i am creating figure caption text frames below the images. Here the concern is i need to group these image and the text box. After this i have to place these images with captions into corresponding pages where the figures have been cited. Also suggest me how to place these images in center of the page as well as in top or bottom of the page margin.
    Can anyone help me for this. Your help will be much appreciated.
    Below is my modified script,
    var myPage;
    main();
    function main(){
        var myFilteredFiles;
        app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
        myExtensions = [".jpg", ".jpeg", ".eps", ".ps", ".pdf", ".tif", ".tiff", ".gif", ".psd", ".ai"]
        var myFolder = Folder.selectDialog("Select the folder containing the images", "");
        if(myFolder != null){
                if(File.fs == "Macintosh"){
                    myFilteredFiles = myMacOSFileFilter(myFolder);
                else{
                    myFilteredFiles = myWinOSFileFilter(myFolder);
                if(myFilteredFiles.length != 0){
                    for (j=0; j<myFilteredFiles.length; j++){
                        var myImages = myFilteredFiles[j];
                        citePage(j);
                        app.activeDocument.pages.item(myPage.name).place(myImages);
                        alert("Done!");
    function myMacOSFileFilter(myFolder){
        var myFilteredFiles = myFolder.getFiles(myFileFilter);
        return myFilteredFiles;
    function myFileFilter(myFile){
        var myFileType = myFile.type;
        switch (myFileType){
            case "JPEG":
            case "EPSF":
            case "PICT":
            case "TIFF":
            case "8BPS":
            case "GIFf":
            case "PDF ":
                return true;
                break;
            default:
            for(var myCounter = 0; myCounter<myExtensions.length; myCounter++){
                var myExtension = myExtensions[myCounter];    
                if(myFile.name.indexOf(myExtension)>-1){
                    return true;
                    break;           
        return false;   
    //To find cited pages
    function citePage(myInst){
        app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
        app.findGrepPreferences.findWhat="(?<=Figure \\d\\.)\\d";
        var myFind=app.findGrep(false);
        myPage = myFind[myInst].characters.item(0).parentTextFrames[0].parent;
        return myPage.name;
    Thanks Regards
    Thiyagu

    The shadow effect has to have something to be applied on, but by default text frames borders and fills are invisible.
    If you set the border of your frame to a color & thickness, you'll see it gets a shadow of its own, independent of the text. (Try it with dotted and dashed lines!)
    Additionally, if you set the fill of your text frame to a solid color, you'll see the single solid shadow you were expecting.

  • Is it possible to create an image from part of a png image???

    i have an image and i want to create 4 indivdual image from it in which they could be combined to reform the image that i have

    Its actually quite easy, first you create a new blank image the size of the section you need, then you draw the larger image onto the new image so that the section you want starts at the top left corner of the new image. I use the code below, which works fine.
    Image image = Image.createImage("/myimage.png");
    int width = [whatever the width of the new image is];
    int height = [whatever the height of the new image is];
    int x = [x position of where your image section starts];
    int y = [y position of where your image section starts];
    //Creates a new Blank Image where we will draw our
    //section on to
    Image imageSection = Image.createImage(width, height);
    Graphics g = imageSection.getGraphics();
    //set the clip
    g.setClip(0,0, width, height);
    //Draws our larger image onto our new image
    g.drawImage(image, -x, -y, g.TOP|g.LEFT);

  • Possible to create a rescue and recovery USB disk?

    When you create rescue and recovery media, there's an option showing "USB hard disk drive". However, the target drive list is always empty. How could I get it work? I have plugged my usb-hard disk to my laptop (T400).
    BTW, it's possible to create the recovery disk using my usb key?

    Probably a good question for ForumNokia. If you mean start up a thread and run in the background while your MIDlet UI does other things, then sure, why not. If you mean that you want to exit your MIDlet, but leave a thread running in the background, then I don't believe you can do this on series 40. S60 is another story since it supports multiple tasks.

  • Is it possible for creating draft BOM and fix approvals in SAP BI

    Can we create draft BOM and set approval for BOM ? If any changes are made in BOM after approval this can be set as amendment to the original BOM.

    Actually to which of the infocpackage it will give priority. 3.5 or 7.3?
    Also I just want to ask that , as in your first reply you said that the cubes cannot be upgraded .... but why?
    And if I am doing new fresh implementation ...........will there be any prerequisites?

  • Create an image and text rollover in Dreamweaver?

    I'm wanting an image and text to have a link and then the image and text to change to another image and text automaticly.  Here is a link that I want it to look like.  (local hot spots) Is there a way in Dreamweaver to do it or by inserting HTML code...
    http://thegospot.com/
    Thanks to any help I can get.

    All depends on what you want. 
    CSS a:hover affects the text/image mouseover state.
    http://alt-web.com/DEMOS/CSS-Button-Sprite.shtml
    Disjointed content inside <span> tags displays wherever you code it to appear on hover.
    http://alt-web.com/DEMOS/CSS-Disjointed-Text-Rollover.shtml
    Nancy O.

  • Create an image and not display it but saving it as a gif

    hi there,
    i want to save an offImage as a gif. i have something like this (just the main lines)
    JPanel jp = new JPanel()
    Image img = jp.createImage(w,h);
    Graphics gph = img.getGraphics();
    gph.draw...
    I've got an encoder class (GifEncoder) which works just fine with an image created as in the example above.But I don't want to display the image. Just create it, draw on it and save it
    Unless i display the image (in the Panel, e.g. jp) I cannot save the picture as a gif. So I must register it with a component. Is there a way I can avoid this?
    Thank you

    I use the following which is for JPEG encoding but should work for GIF:
                                  BufferedImage tempBImage = new BufferedImage(320,240,BufferedImage.TYPE_INT_RGB);
                                  Graphics2D g = tempBImage.createGraphics();
    g.draw~~~(~~~); //do your stuff here
         //Create a fileoutputstream.
         FileOutputStream fos;
         fos = new FileOutputStream(thumbDirString+ "\\" + picName);
         JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(fos);
         encoder.encode(tempBImage);
         fos.flush();
         fos.close();

  • Is it possible to make an image of a MBP, and run it as a virtual machine?

    Is it possible to create an image of an exitsting MBP, transfer the image to another system or server, and run that image as a virtual machine?  If so, how?
    Thank you

    Mac OS X will not run in a virtual machine, except as 10.6 Server:
    https://discussions.apple.com/docs/DOC-6841

  • Which product is most suitable for me? I will be editing images and creating marketing materials for my business?

    I will need to be able to create corporate images and banners, also generate images for my website? which Photoshop product will allow me to do this? As i want to be sure I am purchasing the correct software for my needs? Thanks

    Either Photoshop or Photoshop Elements will do that.  Depending upon what type of images, you may want to look at Adobe IIlustrator as well.

  • Is it possible to create Indicater and control on same holizental slide?

    Is there any possible to create Indicate values and change values on same Horizental slide. Because I am giving loop values to Horizental slide to indicate my values, after certain time if user wanted to move slide bar to another possition. it should move that perticular location then run loop from that value.
    please send me the solution for my problem..
    thank you..
    Sashi

    The loop counter is a built-in variable that you cannot control. It will always increase.
    For your purpose, you must create a seperate variable that contains your index as you want to use it.
    The attached VI shows a possible solution. Let me know if this makes sense to you.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    horizental_slideNEW.vi ‏26 KB

Maybe you are looking for

  • Enhance output of Target Group opened in segment builder

    Hello Experts, We are implementing SAP CRM Lean Marketing using CRM 7.0. Our business requirement is to do segmentation based on Company attributes and Relationship Category. The output of the target group should enlist the persons related to the Com

  • Dynamic Header for a website.    DOUBLE POINTS FOR ANSWER!!

    I don't even know where to start with this one, let me try explain this: I am looking for ideas on how to create some sort of dynamic header for an affiliate website, we have launched a new affiliate program for http://www.africancures.com/ the affil

  • HT2693 I can't buy anything it says contact iTunes support what can I do now

    I can't buy anything it says contact iTunes support what can I do now

  • Adding a field in the VF31 Output list

    Dear Experts We have a requirement such that in the VF31 Output screen which will list the billing document no and the output types, we should add a new column in the output list. This new column will have the sales group key.  Considering that sales

  • Pc Suite Updates

    When i first got my phone the Nokia 6500 slide i installed the disc that came with it which was the PC Suite V: 6.84.10.3 and in it's true form you could see the message's using the software that came with the phone. Plus if you transferred it to the