Create and display an Image within a object?

Hi,
I'd like to make objects that (among other things) hold a GIF-image. Then I would like for these objects to be able to display themselves. Like this:
public class MyApplet extends Applet {
private Tree tree;
public void init() { tree = new Tree();}
public void paint(Graphics g) { tree.display(g);}
class Tree {
private Image im;
public Tree() { //create im here from file "tree.gif" ??}
public void display(Graphics g) { //display im here??}
Any idea how I can do this? Which librarymethods could I use and how?
Thanx,
JB

What you could do is have theTree class extend JLabel and include a constuctor like
public Tree(String filename)
/*path is a class variable*/
path=filename;
     ImageIcon ii= new ImageIcon(filename);
     this.setIcon(ii);
then in a JFrame you could do something like
Tree theTree = new Tree("/images/picture.gif");
add(theTree);
or use a layout Manager. Hope this helped

Similar Messages

  • 2 Custom Fields-create and display

    In addition to the standard fields available within the Whou2019s Who service, we need to create and display 2 custom fields within the employee search functionality in ESS. 
    Can someone walk me through the steps please?

    Hello,
    There are 2 sections of search available.
    1 is normal search and 1 is advances search.
    Well for advanced search you can very much follow my earlier reply.
    And you can also have a look at below thread...
    ESS Who is Who - Add search criteria
    I guess you want to add extra field in normal search.
    I am not sure how to do it....as Siddharth (In link I pasted above) says that he himself have never seen any changes in normal search.......
    But still you can give below method a try.....
    http://wiki.sdn.sap.com/wiki/display/profile/ESS%2bPersonal%2bInformation%2bUI%2benhancement%2bwithout%2bmodification?bc=true

  • How can I simultaneously acquire and display an image on the front panel using a PCI-1408

    I have to acquire and display an image directely in the front panel of a *.vi using a PCI-1408. i have to know all informmations about this image because I want to create a calibration system.

    Hi Paola,
    if you own IMAQ Vision you can just have a look at the examples that comes with your board or you can look at: http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/2abaefe05789961686256866007c0d22?OpenDocument.
    Without IMAQ Vision look at:
    http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/22474456534202b086256aff005fc4f3
    (or search at ni.com for "IMAQ Display without IMAQ Vison)
    Please mail me if you need further help,
    Michael

  • Firefox can't load a Siemens Gigaset network camera but IE8 can. There is an error in the code from the cam. Could Firefox ignore this and display the image anyway ? eg. with Ignore / Abort.

    I run Windows-XP SP3 and I can't get the image from a Siemans Gigaset cam. There is an error in the cam code (a lacking rutine) . IE8 ignores this and displays the image anyway.
    Is it possible to get a notification like Ignore/Abort/ Continue ???

    Does the documentation for that camera, or for the software with it, say anything about ActiveX or about H.264?
    If so, it isn't compatible with Firefox - it doesn't do ActiveX and it doesn't support H.264 in the HTML5 standard. Microsoft just released a plugin for Firefox that adds H.264 support to Firefox, but IIRC that only covers Windows 7 - not WinXP.

  • How to Snap/Grab Image from 1394 camera and display the Image in CWIMAQVIEWER in VC++ ?

    Hi,
    I have :  -  IMAQ1394 2.0.1
                  -  NI Vision 7.1
    In VB, I can Snap/Grab Image from 1394 camera and display the Image in CWIMAQVIEWER :
        Dim Image0 As New CWIMAQImage
        imaq1394SnapCW(sid0,Image0)
        CWIMAQViewer1.Attach Image0
    Now,How can I do this in VC++6.0?
        I tried:
                  C_CWIMAQImage m_imgViewer1;
                  m_imgViewer1 = m_CWIMAQVision1.CreateCWIMAQImage();
                  m_CWIMAQViewer1.Attach(m_imgViewer1);
                  imaq1394SnapCW(Sid,m_imgViewer1);  <--there is no "imaq1394SnapCW "function in VC++,why?
        Please help me!
        Thank you!

    For people looking back at these old posts regarding
    CWIMAQViewer - it was not made to be used in the C environments and is made
    for VB.
    Refer to the following locations for displaying images in C
    environments:
    Start»All Programs»National Instruments»Vision»Documentation
    Start»All
    Programs»National Instruments»Vision»Text Based Examples
    Make
    sure that you look at the examples and documentation that is in
    reference to the C environments not the VB environments
    Vince M
    Applications Engineer

  • Browser can resolve, access, and display JPEG image, but ImageIcon can't.

    I've got this weird problem that only happens with images accessed through a customer's VPN:
    Microsloth Internet Imploder can resolve, access, and display a JPG image from a VPN URL, in the general form:
    http://intranet/part?FOOBAR.JPG which the browser apparently transmogrifies into
    http://mogrify.foo.com/images/scripts/cgi/detail.cgi?FOOBAR.JPG(as Jack Webb often said, the names have been changed to protect the innocent)
    Firefox can also resove, access, and display the image.
    But an ImageIcon, when fed either URL, quietly fails to get anything, No errors, no exceptions, but no image, either.
    The application, if it detects the failure of ImageIcon to come up with the image, somehow (not my code) defers to "Windoze Image and Fax Viewer," which locks up trying to resolve, access, and display the image.
    What could possibly be going on here?

    I'd love to have the luxury of saying, "You lost me at Windoze." Then again, to paraphrase a running gag from Airplane!, it looks like I picked the wrong week to quit hemlock.
    As my final message on my other thread on this topic indicates, the problem is that even though the URL ends in JPG, the server isn't really serving up a JPEG, but rather, an HTML page containing the JPEG.
    Knowing this, a solution (of sorts) presented itself: if the URL doesn't produce a displayable ImageIcon, try constructing a JEditorPane on the URL. The results aren't exactly pretty, and you do have to try the ImageIcon first, but it does work.
    JHHL

  • Editing some descriptions and changing some images within podcast section.

    Hi,
    Editing some descriptions and changing some images within our podcast section.
    I don't have the information needed to log into our feed-burner site, and was wondering if maybe there was another way I could edit the podcast section?

    If Feedburner is taking its information from another feed you can update that feed, unless you have enabled 'Smartcast' in Feedberner which over-rides the original. In that event you can only amend it in Feedburner (either way you can't do it in iTunes).
    You will need to take steps to discover your login; I don't know whether Feedburner Support are likely to be able to help you.

  • Problem with creating and displaying images in a thread

    Hi everyone,
    i need some bit of advice (of course otherwise i wouldn't write anything here). My situation is like this:
    I have a JFrame where the user can enter a string. Then a file that corresponds to this string is read and the information is stored in objects, then these two objects (there are always 2 objects per file) are passed to an ImageCreator class that creates one image with the information found in each object. So per file there are always two images created. Now the thing is that after creating the images i need to display them for 10 seconds each, but as it takes about 2 seconds to create each image i would like to start showing the first one already while the second one is still being created. As i am not really experienced with threads i wonder what would be the best way to manage something like this. Here is a little bit of code, which is still in a rather pseudo code state...if(checkPattern(scanField.getText()) &&
          fc.getFile(createFilename(scanField.getText())) != null)
          BufferedImage img = null;
          ImageDisplay display = new ImageDisplay(scanField.getText(), this);
          for (int i=1; i<3; i++) {
          Info info = tReader.readTelegramForOneInfo(createFilename(scanField.getText()));
          if(i==1) 
            info.setError(ew.getProperty(info.getMTNr1(), info.getLack()));
          if(i==2)
            info.setError(ew.getProperty(info.getMTNr2(), info.getLack()));
            iCreator.setHashtable(info);
            iCreator.setWhichMatNr(i);
            img = iCreator.createImage(false);
            if(i == 1)
                //here i would like to start showing the first image
                display.showImage(img);
          //thats an older version where i displayed both images after they had been
          //created.
          //Thread t = new Thread(new ImageDisplay(scanField.getText(), this));
          //t.start();
          //here i would like to show the second image.
          display.showImage(img);
          scanField.setText("");
        else
           doSomethingElse();
        }I hope you can help me.
    Thanks!

    All actual drawing opertations should occur on the dispatcher thread. When the first image is ready you could use SwingUtiltiies.invokeLater() to place a task on the dispatcher thread to draw the image e.g.
    final BufferedImage img = iCreator.createImage(false);
    if(i == 1)
      SwingUtilities.invokeLater(new Runnable() {
         public void run() {
           display.showImage(img);
       });(Both the variables uses in run() must be final.
    But it's probably better to have a java.awt.Component of some kind for each image to be displayed, and whose paint method does the actual rendering, if the image is ready (is blank otherwise). Then, when the image is ready you need only call repaint on the components.

  • Displaying an image in large object type

    hello
    I am getting large object ( image) from a database.
    like this way:
    obj.read(buf, 0, obj.size());
    I was not able to this image by OutputStream object
    could you give me a hint ?
    regards
    Ahmet Temiz

    orkun wrote:
    InputStream is=rs.getBinaryStream(1); So you get an InputStream to read the image from.
    byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];And you create a byte array which contains a bunch of zeros.
    for (int length; (length = is.read(buffer)) != -1;) {
    out.write(buffer, 0, length); # out is in OutputStream
    }And then you ignore the InputStream where the image was, and copy all the zeroes from
    the byte array to the output.
    that did not display any image.
    what may the problem be ?Do you need more explanation?

  • Import and Display GIF images

    Hi,
    I'm trying to manage images in Abap program.
    Reading on this forum, I'm able to import BMP e TIFF files (via SE78) and display them into a customer control.
    Now I'm trying to manage also GIF images.
    I'm using tc SMW0 to import gif images but with no result.
    This is what I done:
    1. call SMW0
    2. select BINARY DATA
    3. Run (no parameters specified)
    4. New button
    5. Import the GIF file.
    The system display the "No MIME type assigned to object D:\logo.gif" and no images is added.
    What I have to do?
    Thanks
    Salvatore

    Hi Salvatore,
      To display the images in Container you need to
      maintain tem in Business documnets.
      Follow the below steps :
    1) Goto tcode OAER.
    2) Give class name, as type 'OT' and Key name.
    3) Execute it and here you create document and select
       screen in the Document types then upload the bmp or
       gif file and save it.
    4) After that use this in when displaying in Container.
    Thanks&Regards,
    Siri.
    Kindly award points if it is useful.
    Message was edited by: Srilatha T

  • How to create and display items

    Hi All,
    I tried to create an item within the EBS. Using the standard user mfg/welcome, I found the section "Item Manager - Create Engineering Items" and "Item Manager - Create Production Items". Or these objects the same kind of items with just different attributes or are they completely different objects stored in separate tables? I was able to create such an item, but trying to find/display it again using "Item Manager - Item Simple Search" failed with the message "Error - No Organization Access for User". This is weird, write only access ;-). What roles or permissions are necessary to search and display items?
    btw: Is it possible to create an user who is allowed to do everything? Right now, I'm using sysadmin to configure stuff, but this user is obviously not good to create items, BOMs... since the "Item Manager" and many other things are not available here. I would like to have a users who can do almost everything to "explore" the EBS!
    Thanks a lot,
    Konrad

    Hi Konrad;
    What is your EBS version?
    Please check oracle manufacturing guide and Oracle Applications User's Guide from below links to can find answer for your questions
    For r12.1.1:
    http://download.oracle.com/docs/cd/B53825_01/current/html/docset.html
    For r12:
    http://download.oracle.com/docs/cd/B40089_10/current/html/docset.html
    For r11:
    http://download.oracle.com/docs/cd/A60725_05/r11_doc.htm
    Regard
    Helios

  • Load and Display Multiple Images in a Web Dynpro Table

    I am new to Web Dynpro and I am wondering if anyone can help me with an application that I am currently developing. I have a particular requirement to store images in a database table (not MIME repository) and then display them in a WD table element. An image can be of JPEG, PNG or TIFF format and is associated with an employee record.
    I want to create a view in my application that displays multiple images in a table, one image per row. I want to do this using Web Dynpro for ABAP, not Java. I have looked into pretty much all examples available for Web Dynpro and came to the conclusion that Components such as WDR_TEST_EVENTS and WDR_TEST_UI_ELEMENTS do not have any examples of images being stored in a database table and viewed in/from a Web Dynpro table element. Programs such as RSDEMO_PICTURE_CONTROL, DEMO_PICTURE_CONTROL and SAP_PICTURE_DEMO do not show this either.
    The images to be displayed in the Dynpro table are to come from a z-type table, stored in a column of data type XSTRING (RAW STRING). So I would also like to know how to upload these images into this z-type table using ABAP code (not Java).
    Your help would be greatly appreciated.
    Kenn

    Hi,
    May be this is the is the correct place to post your query.
    Web Dynpro ABAP
    Regards,
    Swarna Munukoti.
    Edited by: Swarna Munukoti on Jul 16, 2009 3:52 PM

  • Can an Acrobat form have a field that allows you to select and display an image?

    Hello,
      I'm trying to streamline my most frequent job duty. I work for a box plant and I spend most of my day creating or updating Print Cards. These are letter sized pages that contain the job information along the top and an image of the package laid flat below. What I'm trying to do is make the Print Card a form that I can fill in, and have the final field ask me to select the image. I would then browse for my package design and drop it into the specified field.
      Is this possible? It seems like it should be. I'm fairly illustrator savvy, but I've yet to really get my hands on Acrobat (though I get more excited about it the more research I do).
      Eventually, I want to turn this single form into a full portfolio that would be linked pdf versions of every form we currently use. The info would then be uploaded and assessable by anyone on our team. I don't know how to do half of that, but I'm learning.   So I guess, expect to see me post on this for a while.
    -Jefferson

    Yes, you can set up a button that has a layout other than "Label only" and  use the following as the Mouse Up JavaScript for the button:
    // Mouse Up script for button
    event.target.buttonImportIcon();
    You will then be prompted to select a file as the source of the button icon. You can choose form a number of file types. You should then set the button to read-only before sending the PDF.
    To trigger the import from a different button, bookmark, link, etc., the script would be:
    getField("image_button").buttonImportIcon();
    Replace "image_button" with the actual name of the button that will display the image.

  • How to read local large JPEG files and display into Images Tile

    Hi all,
    I can read the local multiple files by FLEX/AIR FileListEvent
    and loader to read the large JPEG files but cannot display them
    into a TileList. Since it is a number of images files, how can I
    put them into a thumbnail TileList.
    Please kindly advise.
    Regards,
    Billy

    1. So I would like to know which is the {color:#3366ff}best way to load local images in ImageView{color}.I'm no expert, but is there a reason that you are using Swing to do the loading?
    2. secondly, currently the system displays all images only after the completion of creating all images. {color:#3366ff}How to display images as and when they are created.{color} So that the user has a feeling that the images are loading.JavaFX Image class let you display a lightweight placeholder, and you can bind the progress to some kind of visual indicator. I don't think you can display an image that is partially loaded.
    def PATHS: String[] = [
        "C://Ariel Atom//ariel-atom-1.jpg",
        "C://Ariel Atom//ariel-atom-2.jpg",
        "C://Ariel Atom//ariel-atom-3.jpg",
        "C://Ariel Atom//ariel-atom-5.jpg"
    function getImage(path: String): Image {
        Image {
            url: "file:///{path}"
            backgroundLoading: true
    Stage {
        title: "Image Tiles"
        width: 1024
        height: 800
        scene: Scene {
            content: [
                Tile {
                    columns: 2
                    tileWidth: 400
                    tileHeight: 400
                    content: for (i in [0..3]) {
                        ImageView {
                            image: getImage(PATHS)

  • How do I create and display a text file?

    Hello friends,
    I am trying to create a simple unix like operating system with very basic functionality. I have a hard time trying to create a "mktext" file and actually display the contents of the text file with the "cat" command. For example:
    // If I type
    $$ mktext test.txt "We are one"
    $$ Text file is created
    // And if I type
    $$ cat test.txt
    // This line will appear
    $$ "We are one" // Only the contents of the test.txt will display.
    That is what I want to do, but currently stuck. I would appreciate any help and suggestions. Thanks...

    This will do it:
    import java.io.*;
    import java.util.*;
    public class Osys
         BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
    public Osys()
         try
              while(true)
                   System.out.print("$$ ");
                   String s = keyboard.readLine();
                   analize(s);
         catch(Exception e){}
    private void analize(String s)
         if (s.trim().equals("")) return;
         StringTokenizer st = new StringTokenizer(s," ");
         if (!st.hasMoreTokens()) return;
         String s1 = st.nextToken();
         if (s1.equals("cat"))
              if (st.hasMoreTokens()) readIt(st.nextToken().trim());
              System.out.println("");  
              return;
         if (s1.equals("mktext"))
              if (st.hasMoreTokens()) writeIt(st.nextToken().trim(),s);
              System.out.println("");
              return;
    // write
    private void writeIt(String file, String line)
         BufferedWriter writer;
         StringTokenizer st = new StringTokenizer(line,"\"");
         if (st.countTokens() != 2) return;
         st.nextToken();
         try
              writer  = new BufferedWriter(new FileWriter(file));
                 writer.write(st.nextToken()); 
              writer.close();
              System.out.println("$$ Text file is created");  
         catch (IOException e)
               System.out.println(""+e);  
    // read
    private void readIt(String file)
         BufferedReader reader = null;
         String         read   = null;
         try
             reader = new BufferedReader(new FileReader(file));
              while( (read = reader.readLine()) != null)
                  System.out.println("$$ "+read);  
              reader.close();
         catch (IOException e)
               System.out.println(""+e);  
    public static void main(String[] args)
         new Osys();
    }Noah

Maybe you are looking for