<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wiki.twig.es/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.twig.es/index.php?action=history&amp;feed=atom&amp;title=LoadImageApp.java</id>
		<title>LoadImageApp.java - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.twig.es/index.php?action=history&amp;feed=atom&amp;title=LoadImageApp.java"/>
		<link rel="alternate" type="text/html" href="https://wiki.twig.es/index.php?title=LoadImageApp.java&amp;action=history"/>
		<updated>2026-05-06T14:57:22Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.0</generator>

	<entry>
		<id>https://wiki.twig.es/index.php?title=LoadImageApp.java&amp;diff=1457&amp;oldid=prev</id>
		<title>George2: Created page with &quot;&lt;source lang=&quot;java&quot;&gt;  /*  * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.  *  * Redistribution and use in source and binary forms, with or witho...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.twig.es/index.php?title=LoadImageApp.java&amp;diff=1457&amp;oldid=prev"/>
				<updated>2014-11-17T18:09:57Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;  /*  * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.  *  * Redistribution and use in source and binary forms, with or witho...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.&lt;br /&gt;
 *&lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without&lt;br /&gt;
 * modification, are permitted provided that the following conditions&lt;br /&gt;
 * are met:&lt;br /&gt;
 *&lt;br /&gt;
 *   - Redistributions of source code must retain the above copyright&lt;br /&gt;
 *     notice, this list of conditions and the following disclaimer.&lt;br /&gt;
 *&lt;br /&gt;
 *   - Redistributions in binary form must reproduce the above copyright&lt;br /&gt;
 *     notice, this list of conditions and the following disclaimer in the&lt;br /&gt;
 *     documentation and/or other materials provided with the distribution.&lt;br /&gt;
 *&lt;br /&gt;
 *   - Neither the name of Oracle or the names of its&lt;br /&gt;
 *     contributors may be used to endorse or promote products derived&lt;br /&gt;
 *     from this software without specific prior written permission.&lt;br /&gt;
 *&lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &amp;quot;AS&lt;br /&gt;
 * IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR&lt;br /&gt;
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 */&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
import java.awt.*;&lt;br /&gt;
import java.awt.event.*;&lt;br /&gt;
import java.awt.image.*;&lt;br /&gt;
import java.io.*;&lt;br /&gt;
import javax.imageio.*;&lt;br /&gt;
import javax.swing.*;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
 * This class demonstrates how to load an Image from an external file&lt;br /&gt;
 */&lt;br /&gt;
public class LoadImageApp extends Component {&lt;br /&gt;
           &lt;br /&gt;
    BufferedImage img;&lt;br /&gt;
 &lt;br /&gt;
    public void paint(Graphics g) {&lt;br /&gt;
        g.drawImage(img, 0, 0, null);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public LoadImageApp() {&lt;br /&gt;
       try {&lt;br /&gt;
           img = ImageIO.read(new File(&amp;quot;strawberry.jpg&amp;quot;));&lt;br /&gt;
       } catch (IOException e) {&lt;br /&gt;
       }&lt;br /&gt;
 &lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public Dimension getPreferredSize() {&lt;br /&gt;
        if (img == null) {&lt;br /&gt;
             return new Dimension(100,100);&lt;br /&gt;
        } else {&lt;br /&gt;
           return new Dimension(img.getWidth(null), img.getHeight(null));&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public static void main(String[] args) {&lt;br /&gt;
 &lt;br /&gt;
        JFrame f = new JFrame(&amp;quot;Load Image Sample&amp;quot;);&lt;br /&gt;
             &lt;br /&gt;
        f.addWindowListener(new WindowAdapter(){&lt;br /&gt;
                public void windowClosing(WindowEvent e) {&lt;br /&gt;
                    System.exit(0);&lt;br /&gt;
                }&lt;br /&gt;
            });&lt;br /&gt;
 &lt;br /&gt;
        f.add(new LoadImageApp());&lt;br /&gt;
        f.pack();&lt;br /&gt;
        f.setVisible(true);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>George2</name></author>	</entry>

	</feed>