Insert an jpg in a gui

Is it possible to insert a .jpg image within a panel in a GUI?
- how?

1. Use a line like this to create an Image.Image image=Toolkit.getDefaultToolkit().getImage("file/name/for/image.jpg");2. Add a paint() method for the Panel.
3. In the paint() method, use Graphics.drawImage() method to draw the image.

Similar Messages

  • How to insert a JPG image in a column of type "image" in sql server 7.0 ??

    hi all,
    I have a table with 2 columns.
    First col is of "Name" and second col is of type "image" .
    I am using sql server 7.0 on window 2000.
    now i have created table. I want to insert a jpg/gif image in its 2nd column.
    How can i do so ? and how i can i read the image object after insertion ?
    I am using 2nd col of type "image" and NOT Binary or varBinary.
    Any idea will be highly appreciated.
    Thanks in advance.
    AlwaysJava

    hi all,
    I have a table with 2 columns.
    First col is of "Name" and second col is of type
    "image" .
    I am using sql server 7.0 on window 2000.
    now i have created table. I want to insert a jpg/gif
    image in its 2nd column.
    How can i do so ? and how i can i read the image
    object after insertion ?
    I am using 2nd col of type "image" and NOT Binary or
    varBinary.
    Any idea will be highly appreciated.
    Thanks in advance.
    AlwaysJavaHi,
    Below are some excerpts from my program.. which was doing image insertions and retrievals also.. I have included the image insertion and retrieval portion.. retrieval can be done in more than one ways.. one of them is given.. for very large images, u can read chunks of data from the input stream and write it to the disk. for smaller ones , the given methods work very well..
    I tested the program with jdk1.4.0 and aveConnect3.0 driver. on an
    SQL server 7 machine from my box running windows 2000... and it worked..
    Im not still sure if this is the optimised way.. there can be other more optimised methods..
    hope this clears your problem..
    cheers,
    -Jer
        Connection conn = null;
        Statement stmt = null;
        ResultSet rst = null;
        PreparedStatement pstmt = null;
        FileInputStream fis = null;
        FileOutputStream fop = null;
        File file = null;
        InputStream is = null;
        String createtable = "Create table testtable (name varchar(32),_image image)";
        String inserttable = "Insert into testtable values (?,?)";
        String retrievetable = "Select _image from testtable";
        String droptable = "Drop table testtable";
        String url = "jdbc:AvenirDriver://CodeServer:1433/test";
        conn = DriverManager.getConnection(url,"test","test");
    //Create the table
        stmt = conn.createStatement();
        stmt.execute(createtable);
    //Insert the file into the table
        file = new File("input.gif");
        fis = new FileInputStream(file);
        pstmt = conn.prepareStatement(inserttable);
        pstmt.setString(1,file.getName());
    //Set the filestream to the binary stream into the image in the table
        pstmt.setBinaryStream(2,fis,fis.available());
    //Updating the table
        pstmt.executeUpdate();
    //clean up the streams and atatement
        fis.close();
        pstmt.close();
    // Retrieve the image from the table..
        pstmt =  conn.prepareStatement(retrievetable,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
    // execute the Query
        rst = pstmt.executeQuery();
    //jump to the first row of the resultset
        rst.beforeFirst();
        rst.next();
    //get the inputstream from the image object in the  result set
        is = rst.getBinaryStream(1);
    //Writing the data in the inputstream into an outputfile
              //Using getbytes method from the result set
                   byte[] bytearray = rst.getBytes(1);
                   baos = new ByteArrayOutputStream();
                  baos.write(bytearray);
                  fop = new FileOutputStream ("output.gif");
                  baos.writeTo(fop);
    //using the input stream and storing the data in bytearray
    //allocating the buffer size to store the data from inpuit stream ... here whole inptstream is allocated..
    //(The buffer size can be varied if the file is too large and the reading be..
    //  ..done in loop , to read small chunks from the input stream and write it to the file)
        byte[] bytearray = new byte[is.available()];
    //to write the data in the byte array into an output file
        baos = new ByteArrayOutputStream();
        baos.write(bytearray);
        fop = new FileOutputStream ("output.gif");
        baos.writeTo(fop);

  • How to insert a JPG file from file system to Oracle 10g?

    I have developed a schema to store photos as BLOB which store the text description as CLOB original filename, file size.
    I also use ctxsys.context to index TEXT_DESCRIPTION in order to perform Oracle Text Search and it works.
    I would like to insert some JPG file from say C:\MYPHOTO\Photo1.jpg as a new record. How can I do this in SQL PLus and/or Loader?
    How can I retrieve the PHOTO_IMAGE back to the file system using SQL Plus and/or command line in DOS?
    See the following script:
    create user myphoto identified by myphoto;
    grant connect, resource, ctxapp to myphoto;
    connect myphoto/myphoto@orcl;
    PROMPT Creating Table PHOTOS
    CREATE TABLE PHOTOS
    (PHOTO_ID VARCHAR2(15) NOT NULL,
    PHOTO_IMAGE BLOB,
    TEXT_DESCRIPTION CLOB,
    FILENAME VARCHAR2(50),
    FILE_SIZE NUMBER NOT NULL,
    CONSTRAINT PK_PHOTOS PRIMARY KEY (PHOTO_ID)
    create index idx_photos_text_desc on
    PHOTOS(TEXT_DESCRIPTION) indextype is ctxsys.context;
    INSERT INTO PHOTOS VALUES
    ('P00000000000001', empty_blob(), empty_clob(),
    'SCGP1.JPG',100);
    INSERT INTO PHOTOS VALUES
    ('P00000000000002', empty_blob(), 'Cold Play with me at the concert in Melbourne 2005',
    'COLDPLAY1.JPG',200);
    INSERT INTO PHOTOS VALUES
    ('P00000000000003', empty_blob(), 'My parents in Melbourne 2001',
    'COLDPLAY1.JPG',200);
    EXEC CTX_DDL.SYNC_INDEX('idx_photos_text_desc');
    SELECT PHOTO_ID ,TEXT_DESCRIPTION
    FROM PHOTOS;
    SELECT score(1),PHOTO_ID ,TEXT_DESCRIPTION
    FROM PHOTOS
    WHERE CONTAINS(TEXT_DESCRIPTION,'parents',1)> 0
    ORDER BY score(1) DESC;
    SELECT score(1),PHOTO_ID ,TEXT_DESCRIPTION
    FROM PHOTOS
    WHERE CONTAINS(TEXT_DESCRIPTION,'cold play',1)> 0
    ORDER BY score(1) DESC;
    SELECT score(1),score(2), PHOTO_ID ,TEXT_DESCRIPTION
    FROM photos
    WHERE CONTAINS(TEXT_DESCRIPTION,'Melbourne',1)> 0
    AND CONTAINS(TEXT_DESCRIPTION,'2005',2)> 0
    ORDER BY score(1) DESC;

    Hi
    You can use the following to insert an image:
    create table imagetab(id number primary key,imagfile blob, fcol varchar2(10));
    create or replace directory imagefiles as 'c:\'
    declare
        v_bfile BFILE;
        v_blob  BLOB;
      begin
        insert into imagetab (id,imagfile,fcol)
        values (3,empty_blob(),'BINARY')
        return imagfile into v_blob;
        v_bfile := BFILENAME ('IMAGEFILES', 'MyImage.JPG');
        Dbms_Lob.fileopen (v_bfile, Dbms_Lob.File_Readonly);
        Dbms_Lob.Loadfromfile (v_blob, v_bfile, Dbms_Lob.Getlength(v_bfile));
        Dbms_Lob.Fileclose(v_bfile);
        commit;
      end;
    /

  • How to insert a JPG file into a Table from a Form?

    I create a Schema and a Table as follows:
    SQL> create user myphoto identified by myphoto;
    User created.
    SQL> grant connect,resource to myphoto;
    Grant succeeded.
    SQL> create table myphoto.photo_table
    2 (photo_id varchar2(10) primary key,
    3 photo_content blob);
    Table created.
    I would like to build an Oracle Form with a Text Item to enter the full path and filename to be uploaded and inserted into the photo_table; and a Push Button to insert the jpg file into the photo_table.
    Can any one give me details on how this could be done?

    Hi,
    have a look at webutil on otn.oracle.com/products/forms ---> Webutil
    Webutil has the capability to load files into the database.
    Frank

  • No preview when inserting some jpg's

    Hi
    I'm using DW MX 2004.
    When I try and insert certain jpg images there is no preview
    displayed when
    I select it. If I continue the image doesnt appear on the
    page either when I
    view it in a browser.
    The path to the image is correct..
    Outside of DW the jpgs I want to use are viewable in any
    other graphics
    suite.
    So what is the criteria for making jpgs compatible with DW?
    Thanks for any info.
    Ian

    You can use mixed case names as long as you KNOW you are
    using them!
    And it's true that you should avoid names that contain any
    punctuation other
    than hyphens and underscores.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "Ian R" <[email protected]> wrote in message
    news:fr8g9q$ncu$[email protected]..
    >
    > "Ian R" <[email protected]> wrote in message
    > news:fr6e1j$emr$[email protected]..
    >> Hi
    >>
    >> I'm using DW MX 2004.
    >>
    >> When I try and insert certain jpg images there is no
    preview displayed
    >> when I select it. If I continue the image doesnt
    appear on the page
    >> either when I view it in a browser.
    >>
    >> The path to the image is correct..
    >>
    >> Outside of DW the jpgs I want to use are viewable in
    any other graphics
    >> suite.
    >>
    >> So what is the criteria for making jpgs compatible
    with DW?
    >>
    >> Thanks for any info.
    >>
    >> Ian
    >>
    >
    > Thanks for replying guys.
    >
    > Yes you were right it was CMYK.
    >
    > I also had a % sign in the file name. When I chose to
    save with web safe
    > file names it removed the % sign.
    >
    > Is it correct that web page file names should only use
    lower case letters
    > without spaces?
    >
    > Thanks again
    >
    > Ian
    >

  • Jpg,gif, and gui's

    hey guys, I just started learning to code gui's... but my book is vague about inserting jpg or gif.....
    I was using:
    ImageIcon b = new ImageIcon("board.jpg");
    I keep getting a blank canvas..
    Can someone help me with siimple code for making a gui with just a picture in it
    thx

    @OP...
    1) The convention used in your sample code assumes
    that the image source file is in the executing
    directory or classpath.... if not you will need to
    provide the full path...
    eg: "C:/Some
    Directory/SomeOtherDir/Myimage.jpg/.gif/,png"or in a directory off the root:
    root-
    /images
    /classes
    /com
    /whatever
    Then ImageIcon icon = new ImageIcon("images/myImage.gif"); will load
    >
    2) If the Image is large, (not in size only, btw),
    you need to use an ImageTracker or you could resort
    to the
    Toolkit.getDefaultToolkit().getImage("somePath")
    method to ensure that the Image is loaded to
    completion prior to the gui being rendered.. any
    delays will see the ImageIcon being updated after the
    gui is rendered, naturally producing no image.....
    ImageIcon uses a ImageTracker to load images

  • How to set a form field in pro so an 'adobe reader' user can insert a jpg (not a pdf) as an image. It used to work but now doesn't.

    I think this question has been asked a million times before but I'm hoping something has been resolved now! It did work for me and my client a few months ago (by using the 'event.target.buttonImportIcon();' script. I'm 99% certain it worked fine a few months ago, where the adobe reader user could select a jpg to insert...but now it only allows a pdf. Does anyone know if anything can be done? I know you may say LiveCycle but is there really nothing else?
    Thanks in advance.

    There's nothing to solve. If Reader (XI only) is used only PDF files can be selected. This is how it's supposed to work (although I agree it's silly and should be changed).

  • Acrobat Pro / How to insert a jpg or a png in interactive pdf? (I can only insert pdfs)

    Hi, I have created a placeholder for picture in an interactive pdf.
    When I want to insert a picture the only format allowed is pdf.
    I would like to be able to insert jpg or png.
    I had a look online and it seems that I should be able to change the user preferences of Adobe to allow formats like jpg and png to be inserted.
    I can't find the way to do that.
    Any idea?
    Thanks a lot
    Colleen

    Thanks Sara, your suggestion is a very good alternative. By using the tools I can add pictures of any types.
    Following this exemple can I do the same in Acrobate Reader?
    However I was trying to do something different. I have create an action in Acrobat Pro using Javascript
    https://www.youtube.com/watch?v=3rlSo18ntYU
    When I want to insert a picture I have format options but only the pdfs are showing (see screenshot attached). As Bernd told use Acrobate Reader allows only PDFs to be inserted but Acrobate Pro should allow us more options I think... Anymore thoughts?
    Thanks a lot
    Colleen

  • Inserting a jpg Photo

    Hello,
    I received a logo as a .jpg file that needs to be inserted into my report either in a corner of the report or as a background. Can anyone offer steps on how to do one or the other (or even both!)?
    Thanks,
    Megan

    From the Insert menu select Picture.
    For how to make it a background image search the help files for "watermark"

  • PSE7 ~ I'm inserting a .jpg image into a project, need to resize smaller and it ends up blurry!

    Please help!
    I am creating a birthday invitation for my daughter using PSE7.  I found a few .jpeg images on the web that I want to use.  The images should be okay size-wise (a 66kb image) when I try to insert this image onto the invitation (size of the invite is 5x7) - image takes up maybe 1/6th of overall invitation.  When I insert this image into the project, it is HUGE.  I need to resize it to reduce, but when I do for some reason it becomes very blurry.  I can't figure this out!  At the very least a 66kb image should be able to be inserted onto this 5x7 invitation as a 1" square and be crisp at that size??  Ugghh!
    I hope I am being clear in my request...the image in question is pictured below.  When this image is inserted into my PSE project, it would be about 2" high on a 5"x7" invitation...
    Also, when I save the whole invitation as a jpg for printing, it's only 120kb file size...shouldn't it be much larger?  Am I missing a global setting somewhere that's messing everything up??  Many thanks in advance to anybody offering suggestions...

    You're thinking in the wrong terms. You need to be focusing more on ppi (pixels per inch) rather than the file size in KB. Start by  making sure your main image is at 300 ppi (you may have to start over from scratch). If the graphics are now way too small when you bring them in, remove them and try a lower resolution, but you don't want to go below about 220 usually (it depends on your printer how low you can go and get away with it).
    Go to Image>Resize>Image size to check your invite's ppi, but my guess is that you started at something like 72 ppi. If you did, I'd start over, unless you have enough pixels that when you change the ppi to 300 (with Resample Image turned OFF) it's still large enough.

  • How can I insert jpg/bmp files when composing an e mail?

    I want to insert a jpg file into the mail while composing the e mail and avoid sending it as an attachment.
    I've tried copy-paste, but it doesn't work.
    I tried to drag from another window, that doesn't work either.
    I managed to drag a jpg file from another browser (not Firefox), it showed at my end but did not transmit).

    The question relates more to your email system than to Firefox.
    As general comments
    * files and images are likely to be sent as attachments
    * there may be options as to how they display, hotmail for instance is able to display attatched images in firefox as a slideshow within the email
    * sending links rather than attached files is an alternative if the .jpeg is on the web
    * Hotmail, also allows whole Office Files to be inserted. (That includes word processor documents containing images)
    If it is Hotmail and using windows XP you have tried
    * insert | Photos -> web images <br /> left clicking on a displayed image will insert it at the cursor position in the e-mail
    Note Hotmail has its own help information, and a help forum [http://windowslivehelp.com/product.aspx?productid=1 {clickable link)]

  • Insert JPG into Excel

    I'm using MX7 and I create a JPG file using cfchart but I need to insert that JPG into excel with ColdFusion - how do I do it?
    Cfchart is working and I'm saving the file to a location without a problem but can't figure out how to insert it into excel.

    If there is, you can use createObject("com") and try to interact that way, might be a bit painful mind.
    You must really hate EndoplasmicReticulum to be suggesting that
    Nah, I only say that because I had to try to do something like this once and calling Excel via COM in a production environment... really doesn't work very well.  Excel is a desktop app, and doesn't work well being used as a server-side app.
    One could look to see if POI handles that sort of thing?
    If not, from Excel save a sample of the end result as XML, and unpick the XML to work out what one has to do to recreate such a file dynamically, and then... do that.
    Adam

  • Error message: "Dreamweaver can't open .jpg files"

    I'm using DW 8, and I have installed the 8.0.2 update. I'm
    having trouble inserting certain JPG images into a site. I get an
    error message pop-up that states "Dreamweaver can't open .jpg
    files". It will allow me to insert some jpg files, but not all of
    them. I've tried drag & drop and going through the Insert menu.
    The files are not large at all. Doesn't appear to be any problem
    with png's or gif's. It's incredibly frustrating. Anyone have any
    suggestions? TIA.

    > why was i taught that all my web images need
    > to be in 72dpi if it doesn't really matter?
    most people suggest 72 because it was an old standard with
    the early
    macintosh DTP programs. For web use it's easier to
    standardize on it because
    when you make an image, you have to put ~some~ number in the
    resolution box
    and it might as well be 72 as any other number. It simplifies
    moving image
    files around in different applications if they are all the
    same resolution.
    For display in a browser, these will all have the same file
    size and display
    size in a web page:
    600x600 pixels at 1dpi
    600x600 pixels at 72dpi
    600x600 pixels at 6000dpi
    It's when they are used in other applications or when a
    direct url like
    /photos/1.jpg is printed out that they may display in the
    resolution, not
    the pixel dimension.
    I came across a page once where the designer always saved his
    images with a
    resolution of 6000 dpi or some other odd number because he
    thought that if
    people dragged the image off the page to save it- most of
    them wouldn't be
    able to resize it. or some other idiot reason maybe.
    Alan
    Adobe Community Expert, dreamweaver
    http://www.adobe.com/communities/experts/

  • Inserting Image Into XML Publisher Report

    I have a problem to insert an JPG Image(Dynamique Logo depending on setid ) into My XMLPublisher report.
    My Image is stored in database. My query return the field image
    I Use this syntaxe:
    <fo:instream-foreign-object content-type="image/jpg">
    <xsl:value-of select=".//IMAGE"/>
    </fo:instream-foreign-object>
    where IMAGE is the image field name of my query.
    But this does'nt work ; any Help please ?

    Make sure this parameter is set false:
    http://blogs.oracle.com/xmlpublisher/2008/03/secure_your_io.html
    Also follow along this guideline:
    http://blogs.oracle.com/xmlpublisher/2006/05/inserting_blobs_into_your_repo.html
    There you can even find an example
    Cheers
    Jorge
    ps. If this answers your question then please grant the points and close the thread

  • Is javascript capable of exporting specific artboards to a jpg?

    I can export a single artboard to a jpg using the GUI but "artboardRange" doesn't do anything when exporting to a jpg.
    I can use the artboardRange in the pdf save options and that works fine but, while the artboard selection is there in the jpg export dialog in the windows gui I can't get this to work in javascript.
    Am I going to have to copy my content to a separate document containing only what I want and then export from that?
    I tried changing the visibility of objects I didn't want on the jpg but that just leaves a blank area in the resulting jpg even with "artboardClipping" = true. Actually, I don't know that artboardclipping even does anything from what I've tried.
    Any suggestions or does this just not work in JavaScript with CS4?
    Edit:
    If I export to a jpg and use the artboards then a separate jpg is made for each artboard included with a prefix of the artboard # in the name, i.e. filename-01.jpg and filename-02.jpg. It'd be great if I could script this correctly.

    Yeah, these are only document methods in Illustrator.
    Actually, saveAs using PDFSaveOptions doesn't work right either. If I specify an artboard with artboardRange is doesn't do anything different; it just puts each artboard on a separate page in a pdf. However, if I set artboardRange to an empty string it actually changes the name of the current document to a .pdf and THEN I can resave it by adding the artboardRange during the second try which seems a bit odd.
    At this point I don't believe the "Use Artboards" and the "Range" options which are available in the GUI function correctly in Javascript for either saveAs or exportFile which is annoying as I need this to work.
    Also, the PDFSaveOptions.artboardRange string is actually validated and must be either blank or a valid range expression. If I have 2 artboards and I specify '3' it'll fail but if I specify '1' or '2' it still saves all of the artboards. The saveMultipleArtboards option does nothing.

Maybe you are looking for

  • My purchased songs don't show up on my iPod

    I have one of the first generation iPod Touch.  I've purchased songs and they show up on my music in iTunes but even after synching they don't show up on my device.  Can't figure out how to get them there.  Any ideas?  Since Apple change the version

  • My Time Capsule won't let me copy files to it any more

    I've got 2 Time Capsules, one 2TB a couple of years old.  I use it to back up a MacBook Pro and iMac via Time Machine, plus store a large number of files. Until recently it's worked absolutely fine - haven't even had the usual "horribly slowMacine  s

  • Report for equipment with characteristics and value

    Dear friends, I need to develop a report which contains fields from the equipment master like superior equipment, functional location, asset etc. as well as charcteristics and values maintained in the equipment. (Multi level equipment display) is not

  • Schedule fields query

    Hi guys, Can someone tell me where the values for the custom fields in the Microsoft Project Professional 2010 schedule are stored in database? Which table in Project Server 2010 stores the values for fields in the schedule? I want to read these valu

  • Counterfeit Adobe Photoshop CS6?

    Almost at the end of the install process for Photoshop CS6 it says it is a counterfeit file and is corrupt and that I should report piracy. That seems odd because I downloaded it from the Adobe site under "my recent products". Needless to say it stop