Displaying image on the swings application

Hi All,
I want to display images onto my swing application. I was using ImageIcon and Class to getResource(filename). It can only provide me images that i have placed in my package not outside my package.
Please help me, how to to do?
Thanks in advance.

[url http://java.sun.com/docs/books/tutorial/uiswing/components/icon.html]How to Use Icons

Similar Messages

  • Display image in standalone AIR application

    I have loaded images and like to display image in standalone AIR application. But I cannot get it work. The code as follows:
    private function ImageLoader(url:String):void
    var request:URLRequest = new URLRequest(url);
    var loader:Loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderComplete);
    loader.load(request);    
    private function loaderComplete(event:Event):void
    var scaleFactor:Number = 1;
    var uic:UIComponent = new UIComponent();
    try
    var bmp:Bitmap = event.target.content as Bitmap;
    var bmd:BitmapData = bmp.bitmapData; //Bitmap(event.target.content).bitmapData;
    var scaledBMD:BitmapData = new BitmapData(400, 400);
    var matrix:Matrix = new Matrix();
    matrix.scale(scaleFactor, scaleFactor);
    scaledBMD.draw(bmd, matrix, null, null, null, true);
    uic.x = 40;
    uic.y = 40;
    uic.addChild(new Bitmap(scaledBMD));
    catch (errObject:Error)
    trace(errObject.message);

    Found answer by adding mx:Canvas and add
    iconCanvas.addChild(uic);
    after
    uic.addChild(new Bitmap(scaledBMD));
    <mx:Canvas id="iconCanvas" width="10" height="10" horizontalScrollPolicy="off" verticalScrollPolicy="off" x="0" y="0" clipContent="false"/>
    Is anyone create "Canvas" by using new Canvas and get it works? example:
    var canv:Canvas = new Canvas(...);

  • My 8530 does not display images in the browser

    My bb 8530 a few weeks ago suddenly stopped displaying images in the browser. Browser options are set to "display images". I've power cycled many times, even reset and wiped, but still no images in browser. How can I fix this? Thanks.

    hi i have noticed the same problem. also with Chrome and FP ver 11.5.31.2and Firefox and Safari with FP 11.5.502.110
    it seems that MovieClipLoader class not returning onLoadInit event. I use to add a fadein function on loadInit to fade in the loaded images. with the latest Flash PLayer versions this is not activated so you cannot see the loaded images.
    I have tested this on 3 different systems and the problem is the same. I have not updated my FP for IE. There, the older FP still works well.
    test systems
    Mac OS LionSafari and FP 11.5.502.110 --- DOES NOT WORK WELL
    Windows 7 64 bit
    chrome 23.0.1271.95 with FP 11.5.31.2  - DOES NOT WORK WELL
    Firefox 16.02 with FP 11.5.502.110  - DOES NOT WORK WELL
    IE 9 with FP version 11.4.402.287  - WORKS
    Windows XP SP3
    Firefox 16.02 with FP 11.5.502.110 - DOES NOT WORK WELL
    IE 8 wth FP 11.4.402.287  - WORKS
    chrome 23.0.1271.95 with FP 11.5.31.2  - DOES NOT WORK WELL

  • Log of the swing application

    When I run a swing application inside JDeveloper, if an exception is thrown, I see a log in Jdeveloper in 'Running' window.
    Is there such log for the swing application deployed using webstart (somewhere on the client machine)?

    Hi,
    see http://www.lecture123.com/elearning/jws-log.html
    Frank

  • Displaying image in the Title bar

    hi ,
    can any one help me to display image in the JFrame Title Bar Left Corner, Right Corner, orMiddle ..

    double post http://forum.java.sun.com/thread.jsp?forum=57&thread=554453

  • Invoke an awt event from outside the swing application

    Is it possible to invoke an awt event triggered from outside the swing app? I am trying to implement a use case where i have to open a new tab in an already running swing app when a user clicks on a browser link.

    I have a desktop application that was invoked via webstart. The java webstart process started when the user clicked on a link that downloaded the swing application and now it runs in the clients JVM. Each browser click downloades and launches the application that performs a certain function. Now lets say, the user clicks on another link, then i don't want another java application to be launched. I want the same application that executes the function in lets say a new tab.
    Its kind of like you click on a link that somebody sent you in an outlook email. When you click on it and if firefox is already running, the link opens up in a new tab on an already running firefox browser. If firefox was not running, it starts a new firefox process.
    Hope this makes sense

  • Displaying Images in the E-Commerce B2B Application

    Hi All,
        I have added some thumbnails to Products and i replicated the product catalog with all require settings like publishing id, but still the image is not displaying. I have added bitmap image.
       Please let me know How exactly we have to upload the images in to product and what will be the require settings to display the images in the CRM ISA Application.
    Thanks in Advance...

    If you have an image/thumb attached to the Product it will display on the catalog, but not the other way around.  I would love to have a way to mass upload images to the product, but have not seen a way yet...so, for our purposes, it's easier to upload to the catalog.
    In 4.0sr1, there are two check boxes for delta replication of the catalog.  We only check the Transfer Document Content, not Publish Docs via HTTP
    I usually just hit F1 on the field to see what Help is built into the system.  Both of these have good documentation.
    Go to SE38 and review the program COM_PCAT_MASS_DOC_IMPORT
    Here's the Help for that program in CRM4.0sr1:
    Short text
    Mass import of documents for product catalog items
    Title
    Mass Import of Multimedia Documents for Product Catalogs
    Purpose
    This report enables you to automatically import multimedia documents that are already available in a file system and assign these documents to product catalog items. The items are identified using a product number. An item is created if a corresponding one is not available.
    A simple text file, which can be created using the normal spreadsheet programs or simple text editors, is used as a basis for the import. This text file should be made up as follows:
    The first line is ignored, its content is insignificant and can, for example, contain the headings of the columns. The remaining lines correspond to the document that is to be imported and contain 3 to 4 columns with:
    1. The product number of the catalog item that the document is to be added to
    2. The number of the catalog area in which the item is located or in which it is to be created if it has not yet been created
    3. The complete file name, including the path of the document that is to imported and assigned. Make sure that the import takes place on the frontend, that is the frontend must be able to read the file from a specified path
    4. The document type of the document. This specification is optional, make sure that the document type for the catalog is valid for your application (that is to say that a corresponding folder for templates, for items of the catalog type is available)
    Two formats are supported for dividing columns: "Tab-delimited", that is the columns are separated using tabulator characters or "comma separated", that is the columns are separated using semi colons (or another character that is not used in the column contents).
    Selection
    Required parameters are the product catalog and the name of the text file that contains information about the documents that are to be imported.
    You can determine that all documents are to be considered as language-independent, with the "language-independent documents" parameter. You can specify a language in the field "document type" if the indicator is not set.
    The "file format" parameter enables you to inform the system which format the text file has. You can use another separators in addition to the semi colon that is suggested as a default for: "comma separated values"
    If you set the "Delete catalog contents" parameter, all of the catalog items are deleted before the import.
    If you set the "Subsequently activate items" parameter, all of the items are activated after the import.
    Example
    Example for constructing a "comma separated values" file:
    Product number;Catalog area;File;Document type
    100001;AREA1;C:\My Documents\Images\100001_small.gif;CRM_THUMB
    100001;AREA1;C.\My Documents\Images\100001_large.jpg;CRM_IMAGE
    100002;AREA1;C:\My Documents\Images\100002_small.gif;CRM_THUMB

  • Displaying image on the button

    hi there,
    well i wanna display image on my applet button from the relative path how do i do.
    here is my code which i tried gave me nullpointer exception and i did put this code my applets constructor:
    URL url1 = new URL(getDocumentBase().toString()+"b.gif");      
    ImageIcon image1 = new ImageIcon(url1);
    JButton button = new JButton(image1);

    SanderSander
    the code u have given failed to work well here is the code which i tried :
    ImageIcon image1 = new ImageIcon(getImage(getCodeBase(),"b.gif"));      
    JButton button = new JButton(image1);
    and here is the html code for applet :
    <!--"CONVERTED_APPLET"-->
    <!-- CONVERTER VERSION 1.3 -->
    <SCRIPT LANGUAGE="JavaScript"><!--
    var info = navigator.userAgent; var ns = false;
    var ie = (info.indexOf("MSIE") > 0 && info.indexOf("Win") > 0 && info.indexOf("Windows 3.1") < 0);
    //--></SCRIPT>
    <COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
    var ns = (navigator.appName.indexOf("Netscape") >= 0 && ((info.indexOf("Win") > 0 && info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
    //--></SCRIPT></COMMENT>
    <SCRIPT LANGUAGE="JavaScript"><!--
    if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = "500" HEIGHT = "300" codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
    else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODEBASE="http://192.168.1.50/paddy/ns/ns" CODE = "GPTextEditor" MAYSCRIPT="true" WIDTH = "500" HEIGHT = "300" scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
    //--></SCRIPT>
    <APPLET CODE = "GPTextEditor" WIDTH = "500" HEIGHT = "300"></XMP>
    <PARAM NAME = CODE VALUE = "GPTextEditor" >
    <PARAM NAME = CODEBASE VALUE = "http://192.168.1.50/paddy/ns/ns" >
    <PARAM NAME=MAYSCRIPT VALUE=TRUE>
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
    <PARAM NAME="scriptable" VALUE="true">
    </APPLET>
    </NOEMBED></EMBED></OBJECT>
    i m using swing applet.....

  • How to display images in the Personal Java?

    Guys,
    please help me to display the images in gif format in the standalone application using PersonalJava.
    with regards,
    Amin

    JDK:1.1.8; Personaljava:1.1Beta
    Following is my program,it can not only display image but also scroll image that biger than Panel or Canvas.
    import java.awt.*;
    import java.awt.event.*;
    //ImageCanvas object is container keeping Image
    class ImageCanvas extends Canvas
    private Image image,errorimage;
    Container pappy;
    public ImageCanvas(Image i,Container parent)
    errorimage = Toolkit.getDefaultToolkit().getImage("error.gif");
    image=i;
    pappy = parent;
    //following 5 lines can make image display smoothly
    MediaTracker tracker = new MediaTracker(this);
    tracker.addImage(image, 0);
    try { tracker.waitForID(0); }
    catch (InterruptedException e) {}
    public void paint(Graphics g)
    if(image.getWidth(this)==-1)
    image=errorimage;
    Dimension d = getSize();
    this.setSize(image.getWidth(this),image.getHeight(this));
    //Critical syntex for refresh container
    pappy.layout();
    pappy.repaint();
    g.drawImage(image, 0, 0,this);
    public class ScrollingImage implements ActionListener
    {   Frame frame;
    ScrollPane sp;
    Image im;
    public static void main(String[] args)
    ScrollingImage tests= new ScrollingImage();
    tests.go();
    public void go()
    frame = new Frame();
    frame.setLayout(new BorderLayout());
    sp = new ScrollPane();
    im =Toolkit.getDefaultToolkit().getImage("001.gif");
    //please notice following line,critical syntex to display image,I took 2 days to find it.
    sp.add(new ImageCanvas(im,sp));
    sp.setSize(240,290);
    frame.add(sp, BorderLayout.CENTER);
    //following 5 lines make frame be able to close
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    frame.pack();
    frame.setVisible(true);

  • I can't figure out the Keynote title option. I'm a newbie so forgive my ignorance. I want to put an image in the swing arm, but I can't figure it out.

    I even tried opening in Motion and inserting it there, but when I bring it back to fc it's not there. I also want to change the background to an image or at least solid white. When I put an image in the Dropzone it doesn't show up. Any help would be GREATLY appreciated!

    To change the title background to use a clip in the drop zone, do just as Jim said.
    Also, place the clip that want to appear in the "swing arm" right below the title in the timeline.

  • The new version of Adobe Flash Player 11.5.502.110 does not display images in the flash movie.

    In the new version  of Adobe Flash Player 11.5.502.110 the images are not displayed. In previous versions they are displayed. Tested on several computers. This is not a local problem. This is a problem of Adobe. The bad news is that the early versions are very hard to find and reinstall it.
    Many different systems tested. And all browsers.
    Now there is no big image.
    Example:
    http://www.deluxedecor.ru/blog/dvorec_san_susi_letnjaja_rezidencija_fridrikha_velikogo_rok oko/2012-11-01-12
    http://www.deluxedecor.ru/index/kollekcija_lepniny_barokko_ehrmitazh/0-45
    http://www.deluxedecor.ru/index/karnizy/0-12
    and many others.....

    hi i have noticed the same problem. also with Chrome and FP ver 11.5.31.2and Firefox and Safari with FP 11.5.502.110
    it seems that MovieClipLoader class not returning onLoadInit event. I use to add a fadein function on loadInit to fade in the loaded images. with the latest Flash PLayer versions this is not activated so you cannot see the loaded images.
    I have tested this on 3 different systems and the problem is the same. I have not updated my FP for IE. There, the older FP still works well.
    test systems
    Mac OS LionSafari and FP 11.5.502.110 --- DOES NOT WORK WELL
    Windows 7 64 bit
    chrome 23.0.1271.95 with FP 11.5.31.2  - DOES NOT WORK WELL
    Firefox 16.02 with FP 11.5.502.110  - DOES NOT WORK WELL
    IE 9 with FP version 11.4.402.287  - WORKS
    Windows XP SP3
    Firefox 16.02 with FP 11.5.502.110 - DOES NOT WORK WELL
    IE 8 wth FP 11.4.402.287  - WORKS
    chrome 23.0.1271.95 with FP 11.5.31.2  - DOES NOT WORK WELL

  • Display image from the save link in the field

    Hi all,
    I have a image link that saved in a column and will like this picture to be displayed once user is click on the image link in the tabular format.
    However, now I am facing the problem to perform query of the record because one of the field type is image or ole. However, if I changed the image link to normal text item. I am able to perform query search on the record. My question is, can I click on the record whenever I want to see the image from the tabular form ? I prefer tabular form as I can see a lot of records in one sort. But for the image display, I will like user to clock on the specific link in order to open up the image.
    Will this possible ?
    Thanks
    Lim

    If you are saving the image path in table not the image then why don't you use the READ_IMAGE_FILE built-in (see forms help).
    What i mean is hide the actual item which is having the image location. Just create one image item from toolbar (non-database) and create one extra button in the same block to display the image then use the READ_IMAGE_FILE built-in as below in WHEN-BUTTON-PRESS-TRIGGER...
    READ_IMAGE_FILE(:path_item_name,NULL,'image_item_name');
    Preferred way would be to save the image in database then query in your form using database image.
    -Ammad

  • Displaying images in the JavaHelp Viewer

    I have developed a small help system which works, but images are not displayed in the JavaHelp viewer. They are displayed when I load the .html file into a browser.
    All images are collected into an .images file, and are referenced there. The Map entries for each image resembles the Map entries in the sample, but I believe that none of the images within that directory are being displayed by the javahelp system.
    Directory layout in eclipse is:
    <pre>
    <project>
    &brvbar;
    +----help
    &brvbar; &brvbar;
    &brvbar; +-images
    &brvbar; &brvbar;
    &brvbar; +-prj.hs
    &brvbar; &brvbar;
    &brvbar; +-prj.html
    &brvbar; &brvbar;
    &brvbar; +-prjMap.jhm
    &brvbar; &brvbar;
    &brvbar; +-prjTOC.xml
    &brvbar; &brvbar;
    </pre>
    Sample image declaration from Map file: <mapID target="SuccessWin1"
    url="images/Successwin1.png"/>
    When executing in the eclipse IDE, I copy all friles from the help directory to the bin directory so it is in the classpath. When building the .jar, all files from help, and images are placed directly at the first level of the jar so that the '...="images/..."' reference in the Map will succeed. Yet it does not.
    Many thanks for any suggestions.

    I have developed a small help system which works, but images are not displayed in the JavaHelp viewer. They are displayed when I load the .html file into a browser.
    All images are collected into an .images file, and are referenced there. The Map entries for each image resembles the Map entries in the sample, but I believe that none of the images within that directory are being displayed by the javahelp system.
    Directory layout in eclipse is:
    <pre>
    <project>
    &brvbar;
    +----help
    &brvbar; &brvbar;
    &brvbar; +-images
    &brvbar; &brvbar;
    &brvbar; +-prj.hs
    &brvbar; &brvbar;
    &brvbar; +-prj.html
    &brvbar; &brvbar;
    &brvbar; +-prjMap.jhm
    &brvbar; &brvbar;
    &brvbar; +-prjTOC.xml
    &brvbar; &brvbar;
    </pre>
    Sample image declaration from Map file: <mapID target="SuccessWin1"
    url="images/Successwin1.png"/>
    When executing in the eclipse IDE, I copy all friles from the help directory to the bin directory so it is in the classpath. When building the .jar, all files from help, and images are placed directly at the first level of the jar so that the '...="images/..."' reference in the Map will succeed. Yet it does not.
    Many thanks for any suggestions.

  • Debug the swing application from eclipse

    Hi
    I had a swing application, to create a exe file i build the application using using build.xml. To run the application we need to open the exe file.
    I want to debug this swing application from eclipse. Can anybody please tell me how to debug this application.
    Note: I can able to debug simple swing application. But i can't able to debug this application.
    Thanks
    mindus

    If it's an actual .exe--that is, if you've compiled it to a native Windows executable--then you can't debug it using a Java debugger (such as the one in Eclipse).
    If, on the other hand, you just have a .jar file or a bunch of .class files, then you can debug this app the same way you debugged the other one.
    If you don't provide more details about what you actually did and what exact problems you're having ("I can't do it" contains no useful information whatsoever), then it's impossible to provide any more detailed advice than this.

  • Display Image from the database but prevent it from refreshing on every pages

    Hi there,
    I can see there are many discussions around this but my query is slightly different. I'm writing this on behalf of one of my developers. (sorry for my ignorance on techie stuff.. :-))
    A logo is being displayed on a few pages, which is called from the database. However, the problem is that  - this logo refreshes every time when you traverse to each page causing a performance issue or sometimes slow loading of the image.
    My question is - how do we stop it from loading on each page from the database?.  I would rather load once when the main page loads initially and then maintain this on other pages too.
    We can keep this logo on a file system (FS)  and display it via CSS/HTML/frame but since we want to keep it flexible/dynamic where a user can upload a new one whenever it changes and hence DB seems to be the suitable option (in my opinion).
    Can someone please help?
    If you need any further info around the coding how it is being done at present, pls let me know.
    Thank you

    read this http://docs.oracle.com/cd/B28359_01/appdev.111/b28393/adlob_tables.htm#g1017777
    you can cache lobs in the database too
    you can also upload the pic in your file system using utl_file package and then put the image in the working directory mentioned in i.war
    you can then reference the image and it will not be stored in the database and will be cached
    Regards,
    Vishal
    Oracle APEX 4.2 Reporting | Packt Publishing
    Vishal's blog

Maybe you are looking for

  • List_to_memory is not working in background

    Hi Gurus, i am trying to use function module list_to_memory in background.in foreground i am able to send list to memory,but when comes to background it is throwing an error message( i .e list has not been moved to memory) . please help me <<Text rem

  • HDX 18/dv8t IEEE 1394/Fire Wire performance problem in Win 7

    The IEEE1394 interface lives on the PCI express bus at IRQ 16, which is shared by several other devices. Audio interfaces, such as the M-Audio Pro Fire and Fire Wire series do not work reliably with the shared IRQ. In Vista, by comparison, the IEEE 1

  • Run-time error '-2147024894 (80070002)': in Word 2003

    After installing Oracle BIP and attempting to use the add-in to login I get the following message: Run-time error '-2147024894 (80070002)': File or assembly name TBXDOUtilities, or one of its dependencies, was not found. I found another discussion ab

  • Multiple RMI servers in single JVM

    Hi, I have a RMI server listening to requests from internal network as well as external network. RMI returns the hostname as part of the stub. So to ensure that the subsequent RMI calls work fine I need to ensure that jama.rmi.hostname is set to corr

  • I'm unable to restart after 10.9.2 upgrade

    My 2011 17" MacBook Pro is unable to start up at all. It starts up for several seconds showing Apple logo but after that the screen goes light gray (the start-up process background color). Same thing happens with several alternate start-up HD's. I'm