Displaying jpg images in same GUI as buttons

Hi,
I am writing an application that requiers the user to enter the location of a jpg file and this image is then displayed on screen along with a number of buttons.
I am having trouble because I cannot get the image - which I have used mediatracker for, into a JPanel.
I need to use the MediaTracker for other operations that I am pewrforming upon the image
Any suggestions?
Jane

I am writing an application that requiers the user to
enter the location of a jpg file and this image is
then displayed on screen along with a number of
buttons.
I am having trouble because I cannot get the image -
which I have used mediatracker for, into a JPanel.
I need to use the MediaTracker for other operations
that I am pewrforming upon the imageSee JLabel and ImageIcon
JPanel panel = new JPanel();
JLabel label = new JLabel();
panel.add(label);
label.setIcon(icon);

Similar Messages

  • Displaying .jpg images stored in the database

    I created a table and a form to store .jpg images then display the .jpg files in a dynamic page.
    I can insert the images and display the dynamic page but selecting the HREF link will not dispaly the .jpg file.
    I used the Metalink DocID: Note:68016.1 Subject:Browsing database image objects to create the package.
    The package code is as follows
    Create or Replace PACKAGE OREF.IMG
    as
    PROCEDURE select_img_table;
    PROCEDURE retrieve_img_data(img_id varchar2);
    end;
    Create or Replace PACKAGE BODY OREF.IMG
    AS
    PROCEDURE select_img_table AS
    CURSOR c1 IS SELECT id, name FROM filestore;
    BEGIN
    htp.bodyopen;
    FOR i IN c1 LOOP
    htp.print(TO_CHAR(i.id));
    htp.print(i.name);
    htp.anchor('../../pls/oref/IMG.retrieve_img_data?img_id='||to_char(i.id),'jpg',null,null);
    htp.br;
    htp.bodyclose;
    END LOOP;
    END select_img_table;
    PROCEDURE retrieve_img_data(img_id varchar2) AS
    Lob_field BLOB;
    buffer RAW(32767);
    offset BINARY_INTEGER:=1;
    buffer_size NUMBER:=32767;
    BEGIN
    SELECT object INTO lob_field FROM filestore WHERE id=img_id;
    OWA_UTIL.MIME_HEADER('image/jpg');
    LOOP
    DBMS_LOB.READ(lob_field,buffer_size,offset,buffer);
    htp.prn(UTL_RAW.CAST_TO_VARCHAR2(buffer));
    offset:=offset+buffer_size;
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    null;
    END retrieve_img_data;
    END img;
    *The dynamic page Code is as follows:
    <HTML>
    <HEAD>
    <TITLE>Display Filestore Table</TITLE>
    </HEAD>
    <BODY>
    <H2>Display of .jpg files in the Filestore Table</H2>
    <ORACLE>select id, ''||name||''
    from oref.filestore</ORACLE>
    </BODY>
    </HTML>

    You'll need to provide a full URL link to the image ("http://mywebserver/file/images_personnel/28.jpg"), not just a relative path.  Remember, the email client that is used to view the email content knows nothing of the internals of your web server - it can only follow a complete URL to get images and other resources.
    -Carl V.

  • Displaying a image in a gui

    i was wondering how i can display an image using jframe
    what steps would i need to take to get it working

    Yes, there are several ways you can get an image icon either from local disk or network. I have used the simplest approach and shown here how to display an image in user interface.
    As suggested by DrLaszloJamf, using URL is good approach. Locate your image, construct the URL and then create the image icon using that URL.
    Sample code for creating image icon:
         * Locates the image icon at specified {@code path} using given class reference
         * and a short description of the image.
         * Once the URL is resolved it creates an image icon and returns the same.
         * @param cl The class which is used as reference to locate the image icon.
         * @param path The pathname for the image.
         * @param description A brief textual description of the image.
         * @return An image icon. It returns {@code null} if given path can not be resolved
         *               or failed to load the image icon.
        public static ImageIcon createImageIcon(Class cl, String path,
                String description) {
            // Validate inputs here.
            try {
                URL imgURL = cl.getResource(path);
                if (description != null) {
                    return new ImageIcon(imgURL, description);
                } else {
                    return new ImageIcon(imgURL);
            } catch (Exception ex) {
                ex.printStackTrace();
                return null;
        }Thanks,
    Mrityunjoy
    Edited by: mrityunjoy on 6 Feb, 2009 10:22 AM

  • Displaying JPG images in PDF report

    Hi
    We developed a report, wich generates modul documentation from designer repository. In the repository the JPG images are attached to modules. The images have different sizes. The report reads the modules description and displays the images attached to modules.
    The report resizes the images. Seems like the image wide is resized to fit perfectly in the containing frame.
    This behavior is god when we have a bigger image, than the containing frame. But if we have a smaller image than the frame, the reports enlarges the image.
    How can we prevent this behavior?
    Thanks

    I think for that particular image object in layout model, if you can set the vertical and horizontal elasticity to fix, the image will not resize.
    Thanks
    Rohit

  • How do i display an image on a GUI?

    I am making a GUI, and I was trying to post an image(s) on it. I tried various things including turning it into an applet and using the paint(Graphics g) method, but it didn't show up.
    Thanks!

    calm down chief, these people work for a living. They will get to you. Here is a GUI that I did a while ago that has images in it. Maybe it will help you. Let me know.
    import java.awt.*;
    import javax.swing.*;
    public class NestedPanels {
        public static void main(String[] args){
            ImageIcon pic1 = new ImageIcon("nasa1.jpg");
            ImageIcon pic2 = new ImageIcon("nasa2.jpg");
            ImageIcon pic3 = new ImageIcon("nasa3.jpg");
            ImageIcon pic4 = new ImageIcon("whale.jpg");
            JFrame frame = new JFrame("Nested Panels");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //first subpanel
            JPanel subPanel1= new JPanel();
            subPanel1.setPreferredSize(new Dimension(600,600));
            subPanel1.setBackground(Color.white);
            JLabel label1 = new JLabel ("pic one",pic1,0);
            JLabel label2 = new JLabel("pic two",pic2,0);
            subPanel1.add(label1);
            subPanel1.add(label2);
            //second subpanel
            JPanel subPanel2 = new JPanel();
            subPanel2.setPreferredSize(new Dimension(600,600));
            subPanel2.setBackground(Color.white);
            JLabel label3 = new JLabel("pic three",pic3,0);
            JLabel label4 = new JLabel("pic four",pic4,0);
            subPanel2.add (label3);
            subPanel2.add(label4);
            //primary panel
            JPanel primary = new JPanel();
            primary.setBackground(Color.white);
            primary.add(subPanel1);
            primary.add(subPanel2);
            frame.getContentPane().add(primary);
            frame.pack();
            frame.setVisible(true);          
    }You gotta make sure that the pics are in the same folder ok bud?

  • Displaying JPG images

    Hi,
    I have stored few images(jpg format) in database (BLOB datatype). Now the requirement is how to display those items in apex page.
    Example. In employee master screen, the image of employee to be displayed.
    Regards
    PMR

    If you install demonstrative application to your workspace. You can see example how it can be done e.g. from page 3 report and page 6 .
    To install demonstrative application:
    Home>Application Builder>Create and select Demonstration Application
    http://download.oracle.com/docs/cd/E14373_01/appdev.32/e11838/bldapp.htm#sthref751
    Br,Jari

  • Displaying an image in a GUI

    Hi,
    Been looking into diplaying an image in a windows app for 2 days and i really can't believe how much trouble i'm having getting anything to work.
    All the tutorials i'm finding either don't work orthey are only for applets, can anyone help me out getting started with either a good tutorial or some example code they know to work? I am also getting the null pointer exception problem mentioned by another poster, tried putting the image files everywhere they might be looked for.
    I'm getting quite desperate here
    Thanks.

    have an image file test.gif ij the same folder as your .java file
    this will show a JLabel with an icon, in the middle of a panel, with the same
    image set as the bacground of the panel
    import javax.swing.*;
    import java.awt.*;
    class Testing extends JFrame
      Image img;
      public Testing()
        setSize(600,400);
        setLocation(300,100);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        BackgroundPanel bp = new BackgroundPanel();
        bp.setLayout(new GridBagLayout());
        if(img != null) bp.add(new JLabel(new ImageIcon(img)),new GridBagConstraints());
        getContentPane().add(bp);
      class BackgroundPanel extends JPanel
        public BackgroundPanel()
          try
            img = javax.imageio.ImageIO.read(new java.net.URL(getClass().getResource("Test.gif"), "Test.gif"));
          catch(Exception e){}
        public void paintComponent(Graphics g)
          super.paintComponent(g);
          if(img != null) g.drawImage(img, 0,0,this.getWidth(),this.getHeight(),this);
      public static void main(String[] args) {new Testing().setVisible(true);}
    }

  • JPG images not displayed correctly in Bridge and Photoshop

    I am using CS4 under OSX 10.4.11 on a PowerMac G5 Quad. Images which have been captured as JPG are displayed fine by Preview, but when opened in Bridge, Camera Raw or Photoshop. the colours are all "washed out". The attached screen capture should give an idea of the difference, with the upper being Camera Raw (image settings) and the lower being Preview. My monitor has been calibrated and I'm using sRGB IEC61966-2.1 colour space in Camera Raw and Photoshop. what could be causing this?

    I've done some more experimentation. After opening the image in Photoshop without adjustment, then Save As JPEG with embedded color profile, Preview displays the new image the same as Photoshop. Save As JPEG without embedded color profile, and Preview displays this copy just like the original. It seems that Photoshop is making different (incorrect) assumptions about what color space to use when there is no embedded color profile. Shouldn't it assume sRGB like everything else? Or is its interpretation of sRGB incorrect? How can I fix this?

  • JPG images not displayed correctly in Bridge and Photoshop (Mac OS)

    (Note: I have copied the content of this query from the Creative Suites forum where I originally opened it.)
    I am using CS4 under OSX 10.4.11 on a PowerMac G5 Quad with 23" Apple cinema display. Images which have been captured as JPG are displayed fine by Preview, but when opened in Bridge, Camera Raw or Photoshop. the colours are all "washed out". The attached screen capture should give an idea of the difference, with the upper being Camera Raw (image settings) and the lower being Preview. My monitor has been calibrated and I'm using sRGB IEC61966-2.1 colour space in Camera Raw and Photoshop. The colours displayed by Preview are pretty close to "real life". I find it virtually impossible to adjust the colours in Photoshop to get back to anything similar.
    After opening the image in Photoshop without adjustment, and Save As JPEG with embedded color profile, Preview displays the new image the same as Photoshop. Save As JPEG without embedded color profile, and Preview displays this copy just like the original. It seems that Photoshop is making different (incorrect) assumptions about what color space to use when there is no embedded color profile. Shouldn't it assume sRGB like virtually everything else (http://en.wikipedia.org/wiki/SRGB)? Or is its interpretation of sRGB incorrect? How can I fix this?
    Re: JPG images not displayed correctly in Bridge and Photoshop 

    xxxxyyyyz wrote:
    …If there is someone out there who has experience of obtaining decent colour management in CS4 on a Power PC, I would really like to know how you achieved it.
    That would be yours truly, and I hasten to reply because I may have some insights that can help you too.
    Just get it it out of the way, here's my setup:
    Photoshop 11.0.2 ("CS4"); VersionCue disabled and uninstalled.—2.5 GHz Power Mac (PPC) G5-Quad; 16GB RAM; mutant, flashed 550MHz nVidia GeForce 7800GTX 1,700MHz 512MB VRAM; ATTO ExpressPCI UL5D LP SCSI card; Mac OS X Tiger 10.4.11 and Leopard 10.5.8 boot drives; Spotblight, Dashboard and Time Machine permanently disabled; dual 22" CRT monitors; USB wireless 'n' available but connected to the Internet via wired Ethernet; 1 FW flatbed scanner; 2 SCSI scanners (one tabloid-size transparency scanner and a film scanner); various internal & external HDs; FW Epson 2200 and Ethernet Samsung ML-2850ND printers; 2 X Back-UPS RS 1500 XS units.
    I can unambiguously and in good faith represent to you that my color management, from capture to print, is as spot-on as anyone with any kind of setup can hope to achieve.  Unequivocally and without qualifications.
    Now, first things first:  Forget about trying to synchronize color management across the point applications lumped together only by Adobe marketing fiat into a variety of meaningless "creative suites".  Concentrate on Photoshop.  Do not try to use Bridge to synchronize anything.
    The "suites" are a totally artificial construct created by Adobe bean counters and marketing types.  The point applications (i.e. the individual programs clumsily bundled together, e.g. Photoshop, Illustrator, InDesign, etc.) are developed independently by separate engineering teams that are not only not in the same building, but in different cities, different states of the American Union, and even in different countries.  They have very little communication among them, if any, as evidenced by repeated posts in these forums by Photoshop engineering staff urging us, the end users, to let the other teams know in their own forums that a given problem exists and is actually affecting our work.
    Enough said about the cause of the problem.  The end result is that Color Management is at very, very different levels of progress and sophistication in each individual point application, with only Photoshop fully entitled to be considered state of the art.
    Secondly, a disclaimer:  I have been hanging on to my CRT monitors and take care of them as Jascha Heifetz used to take care of his Stradivarius.  I don't know what I will do if I manage to outlive the usefulness and accuracy of my CRTs (unlikely at this point).  I have despaired in futile efforts to bring the luminosity of any LCD monitor down to where I would feel comfortable calibrating and profiling it.  I believe my monitors are the foundation of my color management efforts.
    Especially if you have one of the extreme wide-gamut LCD or LED monitors, you'll face an uphill battle. 
    Be careful to avoid any version 4 icc profiles, whether canned or generated by your calibration software.  Stick to version2 icc profiles.  Ask the manufacturer of your calibration software/hardware if in doubt.
    Here are some not-too-recent, but thoroughly representative screen shots of the calibration results I obtain with my monitors, which I calibrate and profile often and regularly (I validate the calibration at least several times per month).
    In a nutshell, my color management practices and settings mirror those described by Bruce Fraser, Jeff Schewe, Andrew Rodney and Gary Ballard's site.  I have learned from all of them.
    My working color space is ProPhoto RGB.  I choose to work with PSD and PSB files.  As a long-time, rabid JPEG hater, I only rarely deal with JPEGs, using them sporadically to illustrate a point in this forum or elsewhere in the web.  My main output consists of prints.
    I only deal with tagged image files (files with an embedded color profile) and often recommend beating up with a baseball bat any moron that hands you an untagged file—figuratively of course, but I find the expression gets my point across unambiguously.
    Following is a screen shot of some of my pertinent settings:
    Note that I have never bought into the "suite" concept myself.  I do have and routinely use Adobe Illustrator 10.x, InDesign 2.x and Acrobat Professional 8.x, but they are all older, independent versions of each point application, licensed at different times.
    Be further advised, that the answer to many problems offered by Adobe engineers often is not to install VersionCue, or uninstall it, or at least disable it.
    Also, as outlined at the beginning of this post, concentrate on Photoshop, not on synchronizing applications that can't really communicate with each other, despite the claims of Adobe marketing hacks to the contrary.
    One big caveat, do not fall into this trap:
    xxxxyyyyz wrote:
    …I believe my problem has nothing to do with my monitor profile, for several reasons, but…
    …It seems extremely unlikely to me that…
    You either want to learn, or you don't.  You either want to solve your problems, or you don't.
    When you start arguing instead of studying, questioning advice instead of following it and detecting where you went wrong, you're on the right track to nowhere.  That attitude will get you there fast.  Remember you are the one with the problem, and only you can acquire the discipline to learn how to solve it.
    Go ahead and ask me anything that is not clear, just don't argue with me please, and don't tell me why you think Fraser, Rodney, Ballard and I are wrong.  You see, I am not experiencing any problem that needs fixing.  I have an interest in helping you, but not in hearing about your speculations, theories or conclusions.
    Good luck.
    Wo Tai Lao Le
    我太老了

  • Quicktime Pro won't display JPG or create image sequence

    I'm having a problem with QT Pro in that some of my jpg files will open in QT as blank white. When I resize the window, the window blinks with a scrambled image. Same thing happens when I try to create an image sequence.
    This doesn't happen on all my jpg files, maybe about half of them. Also, the same files that don't open properly in QT Pro on my Mac Pro open just fine in QT Pro on another computer. These files also open fine in Preview, Lightroom & Photoshop - it's just QT that's having problems.
    I've deleted and reinstalled QT with no luck. Any ideas what the problem could be? Help is greatly appreciated...

    Try the following:
    System Preferences>Quicktime>Advanced
    Click on the MIME Settings button.
    In the next window that opens up make sure that click on the triangle next to Images - Still image files.
    Make all items are enabled (checked) except for PDF Image.
    Click the OK button.
    Restart your computer.
    ==============
    Take a look in your Home/Library/Internet Plug-Ins folder - if you see any QT plugins or webplugins file there, remove them to the desktop or trash.
    Restart your computer.
    ===============
    Are you trying to view JPG files from a browser or from your HD? Asking because most browsers have a +"file helper"+ preference. For Firefox, it's under the Applications Preferences. There, you can select which type of files you can map to the QT browser plug-in.

  • How to display JPG Icons on push buttons

    Hi there,
    I have come to know that some changes are required in registry.dat file to get jpg images displayed on a push button. Please let me know about the changes required in detail.
    Thanks

    Ali,
    for the registry dat file all the required informationm is in there. Create a virtual directory in your HTTP server to reference the physical directory that holds your images.Open registry.dat and scroll down a bit. You find the section where you can set the image type to use jpg or gif and the virtual path. Add your virtual path as shown in the examples in this file.
    Just add the name of the jpg file, with no extension, to the button's icon name property.
    Alternatively you can use jar files to hold icons too. If you do a search ion this forum then you'll find a lot of comments on that.
    frank

  • Displaying internal image on a push button

    Hi,
    I am running oracle forms 11.1.2.0.0.
    I create a push button and under object property make it an iconic yes
    and under iconic file name I have "java/oracle/forms/icons/save.gif"
    During run-time it displays a image but it is not of save, it is an image of badimage.gif
    Even if I change save.gif to print.gif it is same result.
    What am I missing?
    Thanks
    Munish

    Munish wrote:
    Hi,
    I am running oracle forms 11.1.2.0.0.
    I create a push button and under object property make it an iconic yes
    and under iconic file name I have "java/oracle/forms/icons/save.gif"
    During run-time it displays a image but it is not of save, it is an image of badimage.gif
    Even if I change save.gif to print.gif it is same result.
    What am I missing?
    Hi Munish
    Do you read {thread:id=2513867}

  • Make a GUI display an image

    Im having trouble adding an image to a GUI, ive tryed adding it the same way I would add a JLabel (seeing as there both swing components, i asumed it would work) but it wont work, heres my code.
    import javax.swing.*;
    import java.awt.*;
    public class HelloWorldSwing
        private static void createAndShowGUI()
            JFrame frame = new JFrame("My Gui");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(200, 50);
            frame.setResizable(false);
            frame.setLocationRelativeTo(null);
            ImageIcon image = new ImageIcon("Logo", "C:/Windows/System32/oobe/images/mslogo.jpg" );
            frame.getContentPane().add(image);
            frame.validate();
            frame.setVisible(true);
        public static void main(String[] args)
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }What am I doing wrong ?

    Im having trouble adding an image to a GUI, ive tryed
    adding it the same way I would add a JLabel (seeing
    as there both swing components...An ImageIcon does not inherit from Component. You cannot add an ImageIcon with add()...

  • JPG won't display in Image box.

    Trying to add a logo in JPG format to the top of the form using the Image control, but it won't display the image nor print it. If I use a GIF file it works fine, but looks horrible. I'm new at this, any ideas?

    I finally figured it out after posting another frustrating comment to this thread. I can't take the credit, however, as it was quickly solved by Irv Kanode in another thread. I have copied his exact post below. It solved this issue in seconds:
    ADOBE SUPPORT REPLY:
    Irv Kanode - 4:15pm May 5, 06 PST (#1 of 2)
    Check some of your JPEGs for CMYK vs RGB.
    Might the ones that fail be CMYK and the ones that work be RGB?
    When images don't work are you seeing a broken image icon or...?
    Irv
    Adobe Support
    USER FOLLOWUP TO ADOBE SUPPORT SUGGESTION:
    Kurt Wedberg - 5:27pm May 5, 06 PST (#2 of 2)
    Irv,
    Thanks for the reply. The images that didn't work were CMYK. When I converted to RGB they worked.
    The images that didn't work were coming up with random grey scale colors.
    Thanks again,
    Kurt
    Hope this helps everyone!

  • Some JPG images, stored in DB, do not display on screen/image item.

    Hi friends,
    I have a form to save and retrieve images (JPG, GIF, TIF) to and from DB, using WEBUTIL_FILE_TRANSFER.CLIENT_TO_DB and CLIENT_IMAGE.WRITE_IMAGE_FILE respectively.
    It’s working fine, but with few JPG images, it stores in DB but do not display on screen/image item.
    Secondly, if I try to retrieve and write this JPG to OS (using CLIENT_IMAGE.WRITE_IMAGE_FILE), it prompts error “FRM-47101: Cannot write image file”.
    Environment:
    Forms [32 Bit] Version 10.1.2.0.2
    OS XP Pro 2002 SP3
    Oracle DB 11g Enterprise Edition Rel. 11.1.0.7.0 - 64bit
    Any help will be highly appreciated.

    Hi,
    I have done a workaround here, which worked for me.
    My requirement is to direct save images in DB. So my system was just saving images without knowing if picture would display on form or not later.
    I created a (non-DB) image item on form and added a code (CLIENT_IMAGE.READ_IMAGE_FILE) to place image in this image item, if it successfully display image then save image directly in DB using code (WEBUTIL_FILE_TRANSFER.CLIENT_TO_DB).
    Note: - If CLIENT_IMAGE.READ_IMAGE_FILE fails it raises exception and it means image has invalid format/internal data header and system does not save image in DB.
    Now I have a kind of a filter to stop saving pictures which do not display later on form. :)
    Edited by: user12173428 on 29/09/2011 16:38

Maybe you are looking for

  • [SOLVED] EurKEY PKGBUILD request for comments

    Hi, I just finished a PKGBUILD for EurKEY "European Keyboard Layout". It installs and removes fine on my system, and I took care to respect the packaging standards, but before submitting it to AUR I would like to get any comments/suggestions. PKGBUIL

  • Generating Webservices proxy in JDeveloper 10.1.3.4.0.4270

    Hi, I have been using Jdeveloper 10.1.3.0.4 for creating .net webservice proxy for over a year now. Recently i upgraded the Jdeveloper IDE to 10.1.3.4.0.4270 and since then i m not able to connect to the webservice. Here are the steps i m taking to c

  • How to check a pdf uploaded for press in a website automatically ??

    how to check a pdf uploaded for press in a website automatically ?? i am making a new website for a printer.. his client upload pdf online directly in his website, we want that in the case that the pdf is not as the printer need it for printing , the

  • Best Practice AV set up on SAP Servers

    Hi, Has anyone come across or aware of any best practice guidelines for AV setup on SAP servers, for example, which files/drives should you exclude and configuration tuning/reg-edits required. We have McAfee as our standard AV and we do use the HIPS

  • Why can't itunes locate the music file?

    Lately when I put songs or albums that I've downloaded it won't let me drag the songs into itunes or the folder so I have to put each song into it by making it open up into it and when I do that about a minute or two after, itunes says that it is una