<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7944280718515523707</id><updated>2025-10-06T00:05:18.215-07:00</updated><category term="Java"/><category term="Doble Buffer"/><category term="JFrame"/><category term="Moving images"/><category term="Applet"/><category term="iPhone"/><category term="Android"/><category term="AppleTV"/><category term="Arrows"/><category term="Bluetooth"/><category term="BufferStrategy"/><category term="BufferedImage"/><category term="CA-Mobile API"/><category term="Chat"/><category term="Cocos2d"/><category term="J2ME"/><category term="Jailbreak"/><category term="Keyboard"/><category term="Load Images"/><category term="Media Server."/><category term="Mobile Phone"/><category term="Move Image"/><category term="Objective-C"/><category term="PC"/><category term="Plex"/><category term="Videogames"/><category term="iPad"/><title type='text'>Mobile Programming, videogames and more!</title><subtitle type='html'>This blog shows many examples with code source of several techniques to develop video games and apps for mobile devices like iPhone, iPad, Android, Blackberry using different programming lenguajes as: &#xa;&#xa;Java, J2ME, C++, C# and Objective-C.&#xa;&#xa;Enjoy and comment!&#xa;&#xa;The examples are not tutorials, but shows specific issues and topis related with programming in these lenguajes.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mobile-programming-and-games.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://mobile-programming-and-games.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Rene Cruz</name><uri>http://www.blogger.com/profile/01851511808569040242</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiISLhu6fJFJyqR6Eot7DWhwN2rrKUr2EfOMFMrlyl66ppozeYrjAvogdTdIjVEHwxf5oiWrW8TcoGy1mhfbZoT23ydwyakdv_2k0TWKhHNpPfOcfg-0oBCvEAU1S29/s220/6260_1193755199763_1104905006_30619832_37400_n.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7944280718515523707.post-4375933128813063078</id><published>2014-03-02T18:12:00.001-08:00</published><updated>2014-03-02T18:13:07.296-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AppleTV"/><category scheme="http://www.blogger.com/atom/ns#" term="Jailbreak"/><category scheme="http://www.blogger.com/atom/ns#" term="Media Server."/><category scheme="http://www.blogger.com/atom/ns#" term="Plex"/><title type='text'>How to configure AppleTV 3th Generation for play content of Plex Media Server without Jailbreak!</title><content type='html'>1) Download Plex Media Server&lt;br /&gt;
https://plex.tv/downloads&lt;br /&gt;
&lt;br /&gt;
2) Download PlexConnect &lt;br /&gt;
&lt;br /&gt;
https://github.com/iBaa/PlexConnect&lt;br /&gt;
&lt;br /&gt;
3) Create the cert (Run in terminal)&lt;br /&gt;
&lt;br /&gt;For create &quot;trailers.pem&quot; and &quot;trailers.key&quot; files:
&lt;pre class=&quot;brush: java&quot;&gt;
openssl req -new -nodes -newkey rsa:2048 -out ~/Desktop/trailers.pem -keyout ~/Desktop/trailers.key -x509 -days 7300 -subj &quot;/C=US/CN=trailers.apple.com&quot;&lt;/pre&gt;&lt;br /&gt;
For create &quot;trailers.cer&quot; file:
&lt;pre class=&quot;brush: java&quot;&gt;
openssl x509 -in ~/Desktop/trailers.pem -outform der -out ~/Desktop/trailers.cer &amp;amp;&amp;amp; cat ~/Desktop/trailers.key &amp;gt;&amp;gt; ~/Desktop/trailers.pem&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
4) Move 3 new files to certificates directory&lt;br /&gt;
&lt;br /&gt;
5) Create AppleScript app with follow code:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
tell application &quot;Terminal&quot;
 activate
 do script &quot;cd ruta-hacia-PlexConnect&quot; in front window
 delay 1 -- pause for a second 
 do script &quot;sudo ./PlexConnect.py&quot; in front window
 delay 1 -- pause for a second
 do script &quot;password&quot; in front window
end tell
&lt;/pre&gt;
&lt;br /&gt;
6) Use Apple Configurator to install&amp;nbsp; .cer into AppleTV&lt;br /&gt;
&lt;br /&gt;
7) Modify Settings.py file to change this values:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; a) router IP&lt;br /&gt;
&amp;nbsp;&amp;nbsp; b) complete path to trailers.pam file&lt;br /&gt;
&lt;br /&gt;
8) Configure DSN address in AppleTV, putting IP address of computer which run Plex Media Server&lt;br /&gt;
&lt;br /&gt;
9) In the computer which run Plex Media Server, run the AppleTV3.app in background.&lt;br /&gt;
&lt;br /&gt;
Note: You can change the DNS address for Default Address if you whish.</content><link rel='replies' type='application/atom+xml' href='http://mobile-programming-and-games.blogspot.com/feeds/4375933128813063078/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2014/03/how-to-configure-appletv-3th-generation.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/4375933128813063078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/4375933128813063078'/><link rel='alternate' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2014/03/how-to-configure-appletv-3th-generation.html' title='How to configure AppleTV 3th Generation for play content of Plex Media Server without Jailbreak!'/><author><name>Rene Cruz</name><uri>http://www.blogger.com/profile/01851511808569040242</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiISLhu6fJFJyqR6Eot7DWhwN2rrKUr2EfOMFMrlyl66ppozeYrjAvogdTdIjVEHwxf5oiWrW8TcoGy1mhfbZoT23ydwyakdv_2k0TWKhHNpPfOcfg-0oBCvEAU1S29/s220/6260_1193755199763_1104905006_30619832_37400_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7944280718515523707.post-6035290643823779059</id><published>2011-09-20T07:30:00.000-07:00</published><updated>2013-12-03T19:55:46.986-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Cocos2d"/><category scheme="http://www.blogger.com/atom/ns#" term="iPad"/><category scheme="http://www.blogger.com/atom/ns#" term="iPhone"/><title type='text'>Simple iPhone/iPad game demo using Cocos2DX &amp; iOS 7</title><content type='html'>&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCj2TaBIdD3QzDRXl7M9w_VUDLMXOqk6ioDRabJB-k3MUCzJZ9tQuJggJtVujsLuCZC4z1QEl01KHMYQleYCDJPhsvSyB_w_kESxAPNvrtS6uiJsZc_jJ5txkeBA4aYJfqayPjW7Ky5D4/s1600/Captura+de+pantalla+2011-09-20+a+la%2528s%2529+08.36.55.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5654450947437746738&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCj2TaBIdD3QzDRXl7M9w_VUDLMXOqk6ioDRabJB-k3MUCzJZ9tQuJggJtVujsLuCZC4z1QEl01KHMYQleYCDJPhsvSyB_w_kESxAPNvrtS6uiJsZc_jJ5txkeBA4aYJfqayPjW7Ky5D4/s400/Captura+de+pantalla+2011-09-20+a+la%2528s%2529+08.36.55.png&quot; style=&quot;cursor: hand; cursor: pointer; display: block; height: 313px; margin: 0px auto 10px; text-align: center; width: 400px;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
Simple demo of Ranaship Game, only for education purposes.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Source Code &lt;a href=&quot;https://www.dropbox.com/s/fxxrmkindlirova/Demo_iOS7.zip&quot;&gt;Here!&lt;/a&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mobile-programming-and-games.blogspot.com/feeds/6035290643823779059/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/09/simple-ipad-game-demo-using-cocos2d.html#comment-form' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/6035290643823779059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/6035290643823779059'/><link rel='alternate' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/09/simple-ipad-game-demo-using-cocos2d.html' title='Simple iPhone/iPad game demo using Cocos2DX &amp; iOS 7'/><author><name>Rene Cruz</name><uri>http://www.blogger.com/profile/01851511808569040242</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiISLhu6fJFJyqR6Eot7DWhwN2rrKUr2EfOMFMrlyl66ppozeYrjAvogdTdIjVEHwxf5oiWrW8TcoGy1mhfbZoT23ydwyakdv_2k0TWKhHNpPfOcfg-0oBCvEAU1S29/s220/6260_1193755199763_1104905006_30619832_37400_n.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCj2TaBIdD3QzDRXl7M9w_VUDLMXOqk6ioDRabJB-k3MUCzJZ9tQuJggJtVujsLuCZC4z1QEl01KHMYQleYCDJPhsvSyB_w_kESxAPNvrtS6uiJsZc_jJ5txkeBA4aYJfqayPjW7Ky5D4/s72-c/Captura+de+pantalla+2011-09-20+a+la%2528s%2529+08.36.55.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7944280718515523707.post-7156722826746591167</id><published>2011-05-24T11:08:00.000-07:00</published><updated>2011-05-24T11:25:19.604-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Applet"/><category scheme="http://www.blogger.com/atom/ns#" term="Doble Buffer"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Moving images"/><title type='text'>[Java] Move dinamically images using threads in Java Applet</title><content type='html'>&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiF8taXXkOrHUEmFuQ-rJDXZHRqjordw7Bj-P8waYMRJJCaVDYNAKP5NDXPHYxiD2jY7ROTH6FIdwzdx0LVzoHUMSmeDlg1JfPMFivRajF2J5vLtXzbfX0K9lkzt32cF5ZODUVcmFMn51g/s1600/captura.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 391px; height: 328px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiF8taXXkOrHUEmFuQ-rJDXZHRqjordw7Bj-P8waYMRJJCaVDYNAKP5NDXPHYxiD2jY7ROTH6FIdwzdx0LVzoHUMSmeDlg1JfPMFivRajF2J5vLtXzbfX0K9lkzt32cF5ZODUVcmFMn51g/s400/captura.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5610349192381320274&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This sample show how to move dinamically images in some applet scene, using doble buffer technique and using threas to move one image in a specific direction.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: java&quot;&gt;package mx.gcross.samples;&lt;br /&gt;&lt;br /&gt;import java.applet.Applet;&lt;br /&gt;import java.awt.Graphics;&lt;br /&gt;import java.awt.Image;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author René Cruz - G-Cross Studio 2011&lt;br /&gt; */&lt;br /&gt;&lt;br /&gt;public class MoveImage extends Applet {&lt;br /&gt;&lt;br /&gt;  private Image dobleBuffer;&lt;br /&gt;  private Graphics myGraphics;&lt;br /&gt;  private Image background;&lt;br /&gt;  private Image nave;&lt;br /&gt;  int cordX;&lt;br /&gt;  int cordY;&lt;br /&gt;&lt;br /&gt;  @Override&lt;br /&gt;  public void init() {&lt;br /&gt;    background = getImage(getDocumentBase(), &quot;background.jpg&quot;);&lt;br /&gt;    nave = getImage(getDocumentBase(), &quot;nave.png&quot;);&lt;br /&gt;    &lt;br /&gt;    // Init first coordinates&lt;br /&gt;    cordX = (int) (Math.random() * getWidth());&lt;br /&gt;    cordY = getHeight();&lt;br /&gt;    &lt;br /&gt;    // Init doble buffer&lt;br /&gt;    dobleBuffer = createImage(getWidth(), getHeight());&lt;br /&gt;    myGraphics = dobleBuffer.getGraphics();&lt;br /&gt;&lt;br /&gt;    //Draw images, only the first time&lt;br /&gt;    drawImages();&lt;br /&gt;    animateShip();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  @Override&lt;br /&gt;  public void update(Graphics g) {&lt;br /&gt;    //Draw images in the new positions&lt;br /&gt;    drawImages();&lt;br /&gt;    //Draw the buffer in the screen&lt;br /&gt;    g.drawImage(dobleBuffer, 0, 0, this);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void animateShip() {&lt;br /&gt;    &lt;br /&gt;    Thread hilo = new Thread() {&lt;br /&gt;      @Override&lt;br /&gt;      public void run() {&lt;br /&gt;        try {&lt;br /&gt;          super.run();&lt;br /&gt;          while (true) {&lt;br /&gt;            // change position of Y, and validate if need calculate new coordinates of ship...&lt;br /&gt;            cordY--;&lt;br /&gt;            if (cordY &lt; -30) {&lt;br /&gt;              cordX = (int) (Math.random() * getWidth());&lt;br /&gt;              cordY = getHeight();&lt;br /&gt;            }&lt;br /&gt;            repaint();&lt;br /&gt;            // make a pause for 10 milliseconds&lt;br /&gt;            sleep(10);            &lt;br /&gt;          }&lt;br /&gt;          &lt;br /&gt;        } catch (InterruptedException ex) {&lt;br /&gt;          // do something...&lt;br /&gt;        }&lt;br /&gt;      }&lt;br /&gt;    };&lt;br /&gt;    hilo.start();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void drawImages() {&lt;br /&gt;    myGraphics.drawImage(background, 0, 0, getWidth(), getHeight(), this);&lt;br /&gt;    myGraphics.drawImage(nave, cordX, cordY, this);&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;Test the code and comment, thanks!.&lt;br /&gt;&lt;br /&gt;If you prefer the complete code source, resources and the HTML document in a &lt;a href=&quot;http://netbeans.org&quot; target=&quot;_BLANK&quot;&gt;Netbeans&lt;/a&gt; project, Download It &lt;a href=&quot;http://hotfile.com/dl/118822131/c41545f/MoveImage.rar.html&quot; target=&quot;_BLANK&quot;&gt;Here!&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://mobile-programming-and-games.blogspot.com/feeds/7156722826746591167/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/05/move-dinamically-images-using-threads.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/7156722826746591167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/7156722826746591167'/><link rel='alternate' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/05/move-dinamically-images-using-threads.html' title='[Java] Move dinamically images using threads in Java Applet'/><author><name>Rene Cruz</name><uri>http://www.blogger.com/profile/01851511808569040242</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiISLhu6fJFJyqR6Eot7DWhwN2rrKUr2EfOMFMrlyl66ppozeYrjAvogdTdIjVEHwxf5oiWrW8TcoGy1mhfbZoT23ydwyakdv_2k0TWKhHNpPfOcfg-0oBCvEAU1S29/s220/6260_1193755199763_1104905006_30619832_37400_n.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiF8taXXkOrHUEmFuQ-rJDXZHRqjordw7Bj-P8waYMRJJCaVDYNAKP5NDXPHYxiD2jY7ROTH6FIdwzdx0LVzoHUMSmeDlg1JfPMFivRajF2J5vLtXzbfX0K9lkzt32cF5ZODUVcmFMn51g/s72-c/captura.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7944280718515523707.post-3690688846119076942</id><published>2011-04-11T21:34:00.000-07:00</published><updated>2011-04-12T08:00:32.457-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Bluetooth"/><category scheme="http://www.blogger.com/atom/ns#" term="CA-Mobile API"/><category scheme="http://www.blogger.com/atom/ns#" term="Chat"/><category scheme="http://www.blogger.com/atom/ns#" term="J2ME"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Mobile Phone"/><category scheme="http://www.blogger.com/atom/ns#" term="PC"/><title type='text'>[Java] Connect PC and Mobile Phone over Bluetooth using CA-Mobile API</title><content type='html'>&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihpiaVA6KVn0VGW0OE8YanmZl-whZX9k4ZWEURgEMpNW_xjz4Gbazz-5MLCyDfIFBaBaM1ouqXiugqHoqy01jdx671JZNFcg2avWg7CPce8EO_QlriRs2Dg-TOavTPH2onPVDezDbEI8o/s1600/Library.jpg&quot;&gt;&lt;img style=&quot;float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 188px; height: 400px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihpiaVA6KVn0VGW0OE8YanmZl-whZX9k4ZWEURgEMpNW_xjz4Gbazz-5MLCyDfIFBaBaM1ouqXiugqHoqy01jdx671JZNFcg2avWg7CPce8EO_QlriRs2Dg-TOavTPH2onPVDezDbEI8o/s400/Library.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5594552481166870194&quot; /&gt;&lt;/a&gt;&lt;br /&gt;This example shows how use CA-Mobile API to connect PC and Mobile Phones over Bluetooth connections. In this case, I show you how to implement a Server Bluetooth in a PC and we will use a mobile app for chat between peer (PC or Phone).&lt;br /&gt;&lt;br /&gt;Using the CA-Mobile Framework you can implements collaborative applications in a simple way, because the API simplifies the hard work to control bluetooth communications.&lt;br /&gt;&lt;br /&gt;The CA-Mobile API use bluecove bluetooth library for SE version, and you need add both libraries in your proyects: CA-Mobile Framework API and bluecove 2.1.X. &lt;br /&gt;&lt;br /&gt;See the library package in the image:&lt;br /&gt;&lt;br /&gt;Well, the first code is an Server Control class (MyBTServer.java). The code Here:&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: java&quot;&gt;package mx.camobile.bluetooth;&lt;br /&gt;&lt;br /&gt;import emo.comm.connector.bluetooth.server.BTMultiServer;&lt;br /&gt;import emo.comm.message.common.IMsgProcessor;&lt;br /&gt;import emo.comm.message.common.Message;&lt;br /&gt;import emo.comm.message.common.chat.ChatRoster;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author René Cruz - G-Cross Studio 2011&lt;br /&gt; */&lt;br /&gt;public class MyBTServer {&lt;br /&gt;    //Bluetooth Server Object&lt;br /&gt;&lt;br /&gt;    private final BTMultiServer btServer;&lt;br /&gt;&lt;br /&gt;    public MyBTServer(String nickName, IMsgProcessor processor) {&lt;br /&gt;        /* Create an instance of Bluetooth MultiServer &lt;br /&gt;        Parameters:&lt;br /&gt;        1) The UUID (0x11111) for the published bluetooth service (it will be the same in the mobile app)&lt;br /&gt;        2) One MsgProcessor (in this case, the same class process all incomming messages)&lt;br /&gt;        3) One Roster instance, the Mobile API includes a simple ChatRoster class.&lt;br /&gt;        4) The mode of messages propagation, in this case the sender of messages &lt;br /&gt;         * is excludes of propagation to avoid repeated messages.&lt;br /&gt;        5) Optional, the name of this server. If not specifies a nickname, the bluetooth&lt;br /&gt;         * device ID will be used like nickName.&lt;br /&gt;        */&lt;br /&gt;        btServer = new BTMultiServer(0x11111, processor, new ChatRoster(),&lt;br /&gt;                BTMultiServer.EXCLUDE_SENDER_BROADCAST, nickName);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void startServer() {&lt;br /&gt;        //Start Bluetooth Server&lt;br /&gt;        btServer.startServer();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void sendMessage(Message msg) {&lt;br /&gt;        //Send one message to all connected peers.&lt;br /&gt;        btServer.sendMessage(msg);&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;The follow code is for create a GUI for the Chat Server, however I only comment the lines related with the Bluetooth Server. Here is the code for GUI of Bluetooth Server and Chat:&lt;br /&gt;&lt;pre class=&quot;brush: java&quot;&gt;package mx.camobile.gui;&lt;br /&gt;&lt;br /&gt;import emo.comm.message.common.IMsgProcessor;&lt;br /&gt;import emo.comm.message.common.Message;&lt;br /&gt;import java.awt.BorderLayout;&lt;br /&gt;import java.awt.event.ActionEvent;&lt;br /&gt;import java.awt.event.ActionListener;&lt;br /&gt;import javax.swing.JButton;&lt;br /&gt;import javax.swing.JFrame;&lt;br /&gt;import javax.swing.JLabel;&lt;br /&gt;import javax.swing.JPanel;&lt;br /&gt;import javax.swing.JScrollPane;&lt;br /&gt;import javax.swing.JTextField;&lt;br /&gt;import javax.swing.JTextPane;&lt;br /&gt;import mx.camobile.bluetooth.MyBTServer;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author René Cruz - G-Cross Studio 2011&lt;br /&gt; */&lt;br /&gt;public class SimpleGUI extends JFrame implements ActionListener, IMsgProcessor {&lt;br /&gt;&lt;br /&gt;    private JTextField txtNickName;&lt;br /&gt;    private JTextField txtMessage;&lt;br /&gt;    private JButton btnConnect;&lt;br /&gt;    private JButton btnSend;&lt;br /&gt;    private JTextPane txtHistory;&lt;br /&gt;    private JScrollPane panel;&lt;br /&gt;    private JPanel panelNorth;&lt;br /&gt;    private JPanel panelSouth;&lt;br /&gt;    private MyBTServer btServer;&lt;br /&gt;&lt;br /&gt;    public SimpleGUI() {&lt;br /&gt;        setSize(400, 200);&lt;br /&gt;        setLayout(new BorderLayout());&lt;br /&gt;        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;&lt;br /&gt;        panelNorth = new JPanel();&lt;br /&gt;        panelNorth.add(new JLabel(&quot;Nickname:&quot;));&lt;br /&gt;        txtNickName = new JTextField(20);&lt;br /&gt;        panelNorth.add(txtNickName);&lt;br /&gt;        btnConnect = new JButton(&quot;Connect&quot;);&lt;br /&gt;        btnConnect.addActionListener(this);&lt;br /&gt;        panelNorth.add(btnConnect);&lt;br /&gt;        add(panelNorth, BorderLayout.NORTH);&lt;br /&gt;&lt;br /&gt;        txtHistory = new JTextPane();&lt;br /&gt;        panel = new JScrollPane();&lt;br /&gt;        panel.setViewportView(txtHistory);&lt;br /&gt;        add(panel, BorderLayout.CENTER);&lt;br /&gt;&lt;br /&gt;        panelSouth = new JPanel();&lt;br /&gt;        panelSouth.add(new JLabel(&quot;Message:&quot;));&lt;br /&gt;        txtMessage = new JTextField(20);&lt;br /&gt;        panelSouth.add(txtMessage);&lt;br /&gt;        btnSend = new JButton(&quot;Send&quot;);&lt;br /&gt;        btnSend.addActionListener(this);&lt;br /&gt;        panelSouth.add(btnSend);&lt;br /&gt;        add(panelSouth, BorderLayout.SOUTH);&lt;br /&gt;        setVisible(true);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;        SimpleGUI simpleGUI = new SimpleGUI();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void actionPerformed(ActionEvent e) {&lt;br /&gt;        if (e.getSource() == btnConnect) {&lt;br /&gt;            //Create a instance of BTServer controller&lt;br /&gt;            btServer = new MyBTServer(txtNickName.getText(), this);&lt;br /&gt;            //Start BTServer&lt;br /&gt;            btServer.startServer();&lt;br /&gt;            btnConnect.setEnabled(false);&lt;br /&gt;            txtHistory.setText(&quot;Server started\n&quot;);&lt;br /&gt;        } else if (e.getSource() == btnSend) {&lt;br /&gt;            /*&lt;br /&gt;             * Create an instance of Message class, to send it over BluetoothServer&lt;br /&gt;             * Parameters:&lt;br /&gt;             * 1) Type of message (LOGIN_MESSAGE, LOGOUT_MESSAGE, NORMAL_MESSAGE, ROSTER_MESSATE, SYSTEM_MESSAGE)&lt;br /&gt;             * 2) NickName of sender&lt;br /&gt;             * 3) Body or content of Message&lt;br /&gt;             */            &lt;br /&gt;            Message message = new Message(Message.NORMAL_MESSAGE, txtNickName.getText(), txtMessage.getText());&lt;br /&gt;            //Send message over bluetooth server&lt;br /&gt;            btServer.sendMessage(message);&lt;br /&gt;            txtMessage.setText(&quot;&quot;);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void processMsg(String string) {&lt;br /&gt;        // not used in this example...&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void processMsg(Message msg) {&lt;br /&gt;        // Extract the Type of Message&lt;br /&gt;        switch (msg.getType()) {&lt;br /&gt;            case Message.LOGIN_MESSAGE: {&lt;br /&gt;                txtHistory.setText(txtHistory.getText() + msg.getSender() + &quot; is connected\n&quot;);&lt;br /&gt;            }&lt;br /&gt;            break;&lt;br /&gt;            case Message.LOGOUT_MESSAGE: {&lt;br /&gt;                txtHistory.setText(txtHistory.getText() + msg.getSender() + &quot; was disconnected\n&quot;);&lt;br /&gt;            }&lt;br /&gt;            break;&lt;br /&gt;            case Message.NORMAL_MESSAGE: {&lt;br /&gt;                txtHistory.setText(txtHistory.getText() + msg.getSender() + &quot;: &quot; + msg.getMsgBody() + &quot;\n&quot;);&lt;br /&gt;            }&lt;br /&gt;            break;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void processMsg(int i) {&lt;br /&gt;        // not used in this example...&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;For test this Bluetooth Server, I used a mobile appication that was developed using CA-Mobile API ME version, however I will show you the code in the next examples. The mobile chat application was tested using a Sony Ericsson K790 mobile phone, and works great!&lt;br /&gt;&lt;br /&gt;The libraries used in this example: &lt;br /&gt;&lt;br /&gt;Download &lt;a href=&quot;http://hotfile.com/dl/114187638/821ec1d/FrameworkME-b1.3.rar.html&quot; target=&quot;_BLANK&quot;&gt;CA-Mobile API ME version beta 1.3&lt;/a&gt; &lt;br /&gt;Download &lt;a href=&quot;http://hotfile.com/dl/114187754/1722653/FrameworkSE-b1.0.rar.html&quot; target=&quot;_BLANK&quot;&gt;CA-Mobile API SE version beta 1.0&lt;/a&gt;&lt;br /&gt;Download &lt;a href=&quot;http://hotfile.com/dl/114187408/f90d180/bluecove-2.1.rar.html&quot; target=&quot;_BLANK&quot;&gt;Bluecove Bluetooth Library 2.1&lt;/a&gt; (x86)&lt;br /&gt;Download &lt;a href=&quot;http://hotfile.com/dl/114187189/1b09281/bluecove-2.1.1.rar.html&quot; target=&quot;_BLANK&quot;&gt;Bluecove Bluetooth Library 2.1.1&lt;/a&gt; (x64)&lt;br /&gt;&lt;br /&gt;Test the code and comment, thanks!.&lt;br /&gt;&lt;br /&gt;Download the Netbeans project and mobile application J2ME for testing(.jar/.jad) &lt;a href=&quot;http://hotfile.com/dl/114186967/08dfe5b/MyChatSE.rar.html&quot; target=&quot;_BLANK&quot;&gt;Here!&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://mobile-programming-and-games.blogspot.com/feeds/3690688846119076942/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/04/java-connect-pc-and-mobile-phone-over.html#comment-form' title='13 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/3690688846119076942'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/3690688846119076942'/><link rel='alternate' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/04/java-connect-pc-and-mobile-phone-over.html' title='[Java] Connect PC and Mobile Phone over Bluetooth using CA-Mobile API'/><author><name>Rene Cruz</name><uri>http://www.blogger.com/profile/01851511808569040242</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiISLhu6fJFJyqR6Eot7DWhwN2rrKUr2EfOMFMrlyl66ppozeYrjAvogdTdIjVEHwxf5oiWrW8TcoGy1mhfbZoT23ydwyakdv_2k0TWKhHNpPfOcfg-0oBCvEAU1S29/s220/6260_1193755199763_1104905006_30619832_37400_n.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihpiaVA6KVn0VGW0OE8YanmZl-whZX9k4ZWEURgEMpNW_xjz4Gbazz-5MLCyDfIFBaBaM1ouqXiugqHoqy01jdx671JZNFcg2avWg7CPce8EO_QlriRs2Dg-TOavTPH2onPVDezDbEI8o/s72-c/Library.jpg" height="72" width="72"/><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7944280718515523707.post-2699857669366356078</id><published>2011-04-09T16:42:00.000-07:00</published><updated>2011-04-09T22:33:20.669-07:00</updated><title type='text'>[J2ME]  CA-Mobile Framework</title><content type='html'>&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2dL6qX-Zsn3LXRekAaXyAH2QCkQZz2KpluOFWaYTspcJU13DMkSttf4iyyEHswoTFxRGndlxBAieUXs75rqlR28zS37lf6YKU5ahyj-wE-5adE9W7J7FQnEUDBXXW_mpxkJZQtA563tQ/s1600/logo2.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 83px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2dL6qX-Zsn3LXRekAaXyAH2QCkQZz2KpluOFWaYTspcJU13DMkSttf4iyyEHswoTFxRGndlxBAieUXs75rqlR28zS37lf6YKU5ahyj-wE-5adE9W7J7FQnEUDBXXW_mpxkJZQtA563tQ/s400/logo2.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5593740451191617618&quot; /&gt;&lt;/a&gt;&lt;br /&gt;Well, in this occasion want to show you the CA-Mobile Framework, a tool for design &amp; develop educational collaborative activities based on mobile devices with J2ME support.&lt;br /&gt;&lt;br /&gt;CA-Mobile Framework was developed when I was studying my Ph.D., and includes several instruments for the educational field, however this framework includes an API (CA-Mobile API) for develop collaborative software over Bluetooth communications between mobile devices and PC. For this reason, the CA-Mobile API include two versions: mobile version and desktop version.&lt;br /&gt;&lt;br /&gt;Using this API you can develop applications in mobile devices in an easy way, including a simple and homogeneous GUI based on single menus and canvas to show different content (text, graphics, animations, etc).&lt;br /&gt;&lt;br /&gt;The CA-Mobile API allows you to communicate mobile devices and PC on the same way to exchange string messages and files like images from camera, text, video or http://www.blogger.com/img/blank.gifanother format.&lt;br /&gt;&lt;br /&gt;This is a work in progress but the beta version of two API are available for use it in open and non-comercial projects.&lt;br /&gt;&lt;br /&gt;This is the official site of &lt;a href=&quot;http://azul.iing.mxl.uabc.mx/~renecruz/camobile/&quot; target=&quot;_BLANK&quot;&gt;CA-Mobile Framework&lt;/a&gt; and you can download beta version of API there.&lt;br /&gt;&lt;br /&gt;If you need some help or you are interested in this project, you can contact me by &lt;a href=&quot;mailto:renecruz@remiam.org&quot;&gt;email&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I hope that CA-Mobile API will be to helpfull in your future projects, Enjoy it!&lt;br /&gt;&lt;br /&gt;Demo of app developed with CA-Mobile API:&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;iframe title=&quot;YouTube video player&quot; width=&quot;480&quot; height=&quot;390&quot; src=&quot;http://www.youtube.com/embed/iiM0C5cx_H0&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;/center&gt;</content><link rel='replies' type='application/atom+xml' href='http://mobile-programming-and-games.blogspot.com/feeds/2699857669366356078/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/04/j2me-introduction-to-ca-mobile.html#comment-form' title='3 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/2699857669366356078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/2699857669366356078'/><link rel='alternate' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/04/j2me-introduction-to-ca-mobile.html' title='[J2ME]  CA-Mobile Framework'/><author><name>Rene Cruz</name><uri>http://www.blogger.com/profile/01851511808569040242</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiISLhu6fJFJyqR6Eot7DWhwN2rrKUr2EfOMFMrlyl66ppozeYrjAvogdTdIjVEHwxf5oiWrW8TcoGy1mhfbZoT23ydwyakdv_2k0TWKhHNpPfOcfg-0oBCvEAU1S29/s220/6260_1193755199763_1104905006_30619832_37400_n.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2dL6qX-Zsn3LXRekAaXyAH2QCkQZz2KpluOFWaYTspcJU13DMkSttf4iyyEHswoTFxRGndlxBAieUXs75rqlR28zS37lf6YKU5ahyj-wE-5adE9W7J7FQnEUDBXXW_mpxkJZQtA563tQ/s72-c/logo2.png" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7944280718515523707.post-4811358715367350081</id><published>2011-04-08T15:40:00.000-07:00</published><updated>2011-04-09T11:24:54.254-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Applet"/><category scheme="http://www.blogger.com/atom/ns#" term="Doble Buffer"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Moving images"/><title type='text'>[Java] Draw &amp; moving images inside an Applet using Doble Buffer Technique</title><content type='html'>&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFzxDQdhph36ImI1KtSwkk9y_ElQP2s4LpDxm7XyPoJZ9dMiM5hgRdTYkV1dKHY8kUZdBlCCXm1TmCkUTnAbZwpQMfSCbbDEdemzwxl83ZFD_1Ye1OygnsCdq217iVgxYGZ5vu9R7X7bI/s1600/DobleBufferApplet.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 311px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFzxDQdhph36ImI1KtSwkk9y_ElQP2s4LpDxm7XyPoJZ9dMiM5hgRdTYkV1dKHY8kUZdBlCCXm1TmCkUTnAbZwpQMfSCbbDEdemzwxl83ZFD_1Ye1OygnsCdq217iVgxYGZ5vu9R7X7bI/s400/DobleBufferApplet.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5593349760906195762&quot; /&gt;&lt;/a&gt;&lt;br /&gt;Hi, this is the example of how implements the double buffer technique in an Applet, because the procedure it&#39;s very different compared with JFrame method.&lt;br /&gt;&lt;br /&gt;In this case, I used an instance of Image class to draw in memory all scene, after we will paint it in a single step, this avoid the flicker in the screen when the image is moving.&lt;br /&gt;&lt;br /&gt;NOTE: Remind to create a HTML document to use this Applet.&lt;br /&gt;&lt;br /&gt;The code of Applet is here: &lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: java&quot;&gt;package mx.gcross.samples;&lt;br /&gt;&lt;br /&gt;import java.applet.Applet;&lt;br /&gt;import java.awt.Graphics;&lt;br /&gt;import java.awt.Image;&lt;br /&gt;import java.awt.event.KeyEvent;&lt;br /&gt;import java.awt.event.KeyListener;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author René Cruz - G-Cross Studio 2011&lt;br /&gt; */&lt;br /&gt;public class DobleBufferApplet extends Applet implements KeyListener {&lt;br /&gt;    //Empty image for doblebuffer&lt;br /&gt;    private Image dobleBuffer;&lt;br /&gt;    private Graphics myGraphics;&lt;br /&gt;&lt;br /&gt;    private Image background;&lt;br /&gt;    private Image bird;&lt;br /&gt;    int cordX = 20;&lt;br /&gt;    int cordY = 30;&lt;br /&gt;&lt;br /&gt;    public void init() {&lt;br /&gt;        background = getImage(getDocumentBase(), &quot;background.jpg&quot;);&lt;br /&gt;        bird = getImage(getDocumentBase(), &quot;bird.png&quot;);&lt;br /&gt;&lt;br /&gt;        addKeyListener(this);&lt;br /&gt;&lt;br /&gt;        // Init doble buffer&lt;br /&gt;        dobleBuffer = createImage(getWidth(), getHeight());&lt;br /&gt;        myGraphics = dobleBuffer.getGraphics();&lt;br /&gt;&lt;br /&gt;        //Draw images, only the first time&lt;br /&gt;        drawImages();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    @Override&lt;br /&gt;    public void update(Graphics g) {&lt;br /&gt;        //Draw images in the new positions&lt;br /&gt;        drawImages();&lt;br /&gt;        //Draw the buffer in the screen&lt;br /&gt;        g.drawImage(dobleBuffer, 0, 0, this);        &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void drawImages() {&lt;br /&gt;        myGraphics.drawImage(background, 0, 0, getWidth(), getHeight(), this);&lt;br /&gt;        myGraphics.drawImage(bird, cordX, cordY, this);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;     //While a key is pressed&lt;br /&gt;    public void keyPressed(KeyEvent ke) {&lt;br /&gt;        switch (ke.getKeyCode()) {&lt;br /&gt;            //if the right arrow in keyboard is pressed...&lt;br /&gt;            case KeyEvent.VK_RIGHT: {&lt;br /&gt;                cordX +=3;&lt;br /&gt;            }&lt;br /&gt;            break;&lt;br /&gt;&lt;br /&gt;            //if the left arrow in keyboard is pressed...&lt;br /&gt;            case KeyEvent.VK_LEFT: {&lt;br /&gt;                cordX -=3;&lt;br /&gt;            }&lt;br /&gt;            break;&lt;br /&gt;&lt;br /&gt;            //if the down arrow in keyboard is pressed...&lt;br /&gt;            case KeyEvent.VK_DOWN: {&lt;br /&gt;                cordY +=3;&lt;br /&gt;            }&lt;br /&gt;            break;&lt;br /&gt;&lt;br /&gt;            //if the up arrow in keyboard is pressed...&lt;br /&gt;            case KeyEvent.VK_UP: {&lt;br /&gt;                cordY -=3;&lt;br /&gt;            }&lt;br /&gt;            break;&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;        //call explicit to paint&lt;br /&gt;        repaint();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    //When a key is typed (once)&lt;br /&gt;    public void keyTyped(KeyEvent ke) {&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    //When a key is released (typed or pressed)&lt;br /&gt;    public void keyReleased(KeyEvent ke) {&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;Test the code and comment, thanks!.&lt;br /&gt;&lt;br /&gt;If you prefer the complete code source, resources and the HTML document in a &lt;a href=&quot;http://netbeans.org&quot; target=&quot;_BLANK&quot;&gt;Netbeans&lt;/a&gt; project, Download It &lt;a href=&quot;http://hotfile.com/dl/113826728/c8c424f/DobleBufferApplet.zip.html&quot; target=&quot;_BLANK&quot;&gt;Here!&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://mobile-programming-and-games.blogspot.com/feeds/4811358715367350081/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/04/draw-moving-images-inside-applet-using.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/4811358715367350081'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/4811358715367350081'/><link rel='alternate' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/04/draw-moving-images-inside-applet-using.html' title='[Java] Draw &amp; moving images inside an Applet using Doble Buffer Technique'/><author><name>Rene Cruz</name><uri>http://www.blogger.com/profile/01851511808569040242</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiISLhu6fJFJyqR6Eot7DWhwN2rrKUr2EfOMFMrlyl66ppozeYrjAvogdTdIjVEHwxf5oiWrW8TcoGy1mhfbZoT23ydwyakdv_2k0TWKhHNpPfOcfg-0oBCvEAU1S29/s220/6260_1193755199763_1104905006_30619832_37400_n.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFzxDQdhph36ImI1KtSwkk9y_ElQP2s4LpDxm7XyPoJZ9dMiM5hgRdTYkV1dKHY8kUZdBlCCXm1TmCkUTnAbZwpQMfSCbbDEdemzwxl83ZFD_1Ye1OygnsCdq217iVgxYGZ5vu9R7X7bI/s72-c/DobleBufferApplet.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7944280718515523707.post-630457269145323912</id><published>2011-04-08T14:55:00.001-07:00</published><updated>2011-04-09T22:29:49.898-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="BufferStrategy"/><category scheme="http://www.blogger.com/atom/ns#" term="Doble Buffer"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="JFrame"/><category scheme="http://www.blogger.com/atom/ns#" term="Moving images"/><title type='text'>[Java] Move images inside JFrame using Doble Buffer Technique</title><content type='html'>&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXAQVk0iU_t_EiCeVnurhhD4Eop9i0XjHzc0B-FfT_Yk8zAeUHILu1Bc2xj5QxhwA_5F_p3Hu5Y0ivt_mvhDty28y0k28dkvWwOSHypa0hLQpVmNL0HGcz1iQzemdfErWHn7j6DOyfJsQ/s1600/MoveImage.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 400px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXAQVk0iU_t_EiCeVnurhhD4Eop9i0XjHzc0B-FfT_Yk8zAeUHILu1Bc2xj5QxhwA_5F_p3Hu5Y0ivt_mvhDty28y0k28dkvWwOSHypa0hLQpVmNL0HGcz1iQzemdfErWHn7j6DOyfJsQ/s400/MoveImage.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5593289372542497234&quot; /&gt;&lt;/a&gt;&lt;br /&gt;Here is an example of how to draw and move images inside JFrame using the Doble Buffer technique and BufferStrategy model.&lt;br /&gt;&lt;br /&gt;This technique is used to avoid the flicker in the screen when an image is moving. In case of Applets the doble buffer technique is different, see the next example.&lt;br /&gt;&lt;br /&gt;The code here:&lt;br /&gt;&lt;pre class=&quot;brush: java&quot;&gt;package mx.gcross.samples;&lt;br /&gt;&lt;br /&gt;import java.awt.Graphics;&lt;br /&gt;import java.awt.Graphics2D;&lt;br /&gt;import java.awt.event.KeyEvent;&lt;br /&gt;import java.awt.event.KeyListener;&lt;br /&gt;import java.awt.image.BufferStrategy;&lt;br /&gt;import java.awt.image.BufferedImage;&lt;br /&gt;import java.io.File;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import javax.imageio.ImageIO;&lt;br /&gt;import javax.swing.JFrame;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author René Cruz - G-Cross Studio 2011&lt;br /&gt; */&lt;br /&gt;public class DobleBufferJFrame extends JFrame implements KeyListener {&lt;br /&gt;    &lt;br /&gt;    //Objects for images&lt;br /&gt;    private BufferedImage background;&lt;br /&gt;    private BufferedImage bird;&lt;br /&gt;    //First coordinates of bird image&lt;br /&gt;    private int cordX = 50;&lt;br /&gt;    private int cordY = 250;&lt;br /&gt;    //Objects for doble buffer&lt;br /&gt;    private BufferStrategy myBuffer;&lt;br /&gt;&lt;br /&gt;    public DobleBufferJFrame() {&lt;br /&gt;        setTitle(&quot;Doble Buffer Image Sample&quot;);&lt;br /&gt;        //set window dimension 480x320px&lt;br /&gt;        setSize(512, 512);&lt;br /&gt;        //load images...&lt;br /&gt;        loadImages();&lt;br /&gt;        //make window visible&lt;br /&gt;        setVisible(true);&lt;br /&gt;        //Ignore OS paint calls&lt;br /&gt;        setIgnoreRepaint(true);&lt;br /&gt;&lt;br /&gt;        //create a doble buffer objects&lt;br /&gt;        //NOTE: It&#39;s very important to create bufferStrategy after&lt;br /&gt;        //JFrame is visible, in other case fail!&lt;br /&gt;        this.createBufferStrategy(2);&lt;br /&gt;        myBuffer = this.getBufferStrategy();&lt;br /&gt;        //call explicit to paint first time&lt;br /&gt;        repaint();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void loadImages() {&lt;br /&gt;        try {&lt;br /&gt;            //path for image file&lt;br /&gt;            String pathBackground = &quot;images/background.jpg&quot;;&lt;br /&gt;            background = ImageIO.read(new File(pathBackground));&lt;br /&gt;            String pathBird = &quot;images/bird.png&quot;;&lt;br /&gt;            bird = ImageIO.read(new File(pathBird));&lt;br /&gt;&lt;br /&gt;        } catch (IOException ex) {&lt;br /&gt;            ex.printStackTrace();&lt;br /&gt;        }&lt;br /&gt;        //asociate the keyboard listener with this JFrame&lt;br /&gt;        addKeyListener(this);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void drawImages(Graphics2D g) {&lt;br /&gt;        //draw brackground image (first image)&lt;br /&gt;        g.drawImage(background, 0, 0, this);&lt;br /&gt;        //draw bird image (second image, in this order)&lt;br /&gt;        g.drawImage(bird, cordX, cordY, this);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void paint(Graphics g) {&lt;br /&gt;        Graphics2D g2 = null;&lt;br /&gt;        if (myBuffer != null) {&lt;br /&gt;            try {&lt;br /&gt;                //get the graphics2d object of the buffer&lt;br /&gt;                g2 = (Graphics2D) myBuffer.getDrawGraphics();&lt;br /&gt;                //draw images in buffer&lt;br /&gt;                drawImages(g2);&lt;br /&gt;            } finally {&lt;br /&gt;                g2.dispose();&lt;br /&gt;            }&lt;br /&gt;            //draw the content of buffer in the screen&lt;br /&gt;            myBuffer.show();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;        new DobleBufferJFrame();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    //While a key is pressed&lt;br /&gt;    public void keyPressed(KeyEvent ke) {&lt;br /&gt;        switch (ke.getKeyCode()) {&lt;br /&gt;            //if the right arrow in keyboard is pressed...&lt;br /&gt;            case KeyEvent.VK_RIGHT: {&lt;br /&gt;                cordX ++;&lt;br /&gt;            }&lt;br /&gt;            break;&lt;br /&gt;&lt;br /&gt;            //if the left arrow in keyboard is pressed...&lt;br /&gt;            case KeyEvent.VK_LEFT: {&lt;br /&gt;                cordX --;&lt;br /&gt;            }&lt;br /&gt;            break;&lt;br /&gt;&lt;br /&gt;            //if the down arrow in keyboard is pressed...&lt;br /&gt;            case KeyEvent.VK_DOWN: {&lt;br /&gt;                cordY ++;&lt;br /&gt;            }&lt;br /&gt;            break;&lt;br /&gt;&lt;br /&gt;            //if the up arrow in keyboard is pressed...&lt;br /&gt;            case KeyEvent.VK_UP: {&lt;br /&gt;                cordY --;&lt;br /&gt;            }&lt;br /&gt;            break;&lt;br /&gt;&lt;br /&gt;        } &lt;br /&gt;        //call explicit to paint&lt;br /&gt;        repaint();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    //When a key is typed (once)&lt;br /&gt;    public void keyTyped(KeyEvent ke) {&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    //When a key is released (typed or pressed)&lt;br /&gt;    public void keyReleased(KeyEvent ke) {&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;Test the code and comment, thanks!.&lt;br /&gt;&lt;br /&gt;If you prefer the complete code source and resources in a &lt;a href=&quot;http://netbeans.org&quot; target=&quot;_BLANK&quot;&gt;Netbeans&lt;/a&gt; project, Download It &lt;a href=&quot;http://hotfile.com/dl/113824806/5d331d0/DobleBufferApplet.zip.html&quot; target=&quot;_BLANK&quot;&gt;Here!&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://mobile-programming-and-games.blogspot.com/feeds/630457269145323912/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/04/move-images-inside-jframe-using-doble.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/630457269145323912'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/630457269145323912'/><link rel='alternate' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/04/move-images-inside-jframe-using-doble.html' title='[Java] Move images inside JFrame using Doble Buffer Technique'/><author><name>Rene Cruz</name><uri>http://www.blogger.com/profile/01851511808569040242</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiISLhu6fJFJyqR6Eot7DWhwN2rrKUr2EfOMFMrlyl66ppozeYrjAvogdTdIjVEHwxf5oiWrW8TcoGy1mhfbZoT23ydwyakdv_2k0TWKhHNpPfOcfg-0oBCvEAU1S29/s220/6260_1193755199763_1104905006_30619832_37400_n.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXAQVk0iU_t_EiCeVnurhhD4Eop9i0XjHzc0B-FfT_Yk8zAeUHILu1Bc2xj5QxhwA_5F_p3Hu5Y0ivt_mvhDty28y0k28dkvWwOSHypa0hLQpVmNL0HGcz1iQzemdfErWHn7j6DOyfJsQ/s72-c/MoveImage.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7944280718515523707.post-2406153957186760471</id><published>2011-04-08T11:44:00.000-07:00</published><updated>2011-04-09T11:24:33.967-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arrows"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="JFrame"/><category scheme="http://www.blogger.com/atom/ns#" term="Keyboard"/><category scheme="http://www.blogger.com/atom/ns#" term="Move Image"/><title type='text'>[Java] Move an image inside JFrame or Applet using keyboard!</title><content type='html'>&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXAQVk0iU_t_EiCeVnurhhD4Eop9i0XjHzc0B-FfT_Yk8zAeUHILu1Bc2xj5QxhwA_5F_p3Hu5Y0ivt_mvhDty28y0k28dkvWwOSHypa0hLQpVmNL0HGcz1iQzemdfErWHn7j6DOyfJsQ/s1600/MoveImage.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 400px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXAQVk0iU_t_EiCeVnurhhD4Eop9i0XjHzc0B-FfT_Yk8zAeUHILu1Bc2xj5QxhwA_5F_p3Hu5Y0ivt_mvhDty28y0k28dkvWwOSHypa0hLQpVmNL0HGcz1iQzemdfErWHn7j6DOyfJsQ/s400/MoveImage.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5593289372542497234&quot; /&gt;&lt;/a&gt;&lt;br /&gt;This example show how to load and move one image using keyboard arrows inside a JFrame or an Applet, it&#39;s the same procedure. &lt;br /&gt;&lt;br /&gt;It&#39;s not a good way to draw and move the images  with this method, because you will see flashing the window  while the image is moving, but it&#39;s the most simple way to show you how know which key was pressed and how move the image. In the next example, I will show you how to draw images using a doble buffer technique in order to avoid the flashing in the screen!.&lt;br /&gt;&lt;br /&gt;Well, the code for this example is here:&lt;br /&gt;&lt;pre class=&quot;brush: java&quot;&gt;package mx.gcross.samples;&lt;br /&gt;&lt;br /&gt;import java.awt.Graphics;&lt;br /&gt;import java.awt.event.KeyEvent;&lt;br /&gt;import java.awt.event.KeyListener;&lt;br /&gt;import java.awt.image.BufferedImage;&lt;br /&gt;import java.io.File;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import javax.imageio.ImageIO;&lt;br /&gt;import javax.swing.JFrame;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author René Cruz - G-Cross Studio 2011&lt;br /&gt; */&lt;br /&gt;public class MoveImage extends JFrame implements KeyListener {&lt;br /&gt;    //Objects for images&lt;br /&gt;&lt;br /&gt;    private BufferedImage background;&lt;br /&gt;    private BufferedImage bird;&lt;br /&gt;    //First coordinates of bird image&lt;br /&gt;    private int cordX = 50;&lt;br /&gt;    private int cordY = 250;&lt;br /&gt;&lt;br /&gt;    public MoveImage() {&lt;br /&gt;        setTitle(&quot;Move Image Sample&quot;);&lt;br /&gt;        setSize(512, 512); //set window dimension 480x320px&lt;br /&gt;        loadImages();&lt;br /&gt;        setVisible(true); //make window visible&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void loadImages() {&lt;br /&gt;        try {&lt;br /&gt;            //path for image file&lt;br /&gt;            String pathBackground = &quot;images/background.jpg&quot;;&lt;br /&gt;            background = ImageIO.read(new File(pathBackground));&lt;br /&gt;            String pathBird = &quot;images/bird.png&quot;;&lt;br /&gt;            bird = ImageIO.read(new File(pathBird));&lt;br /&gt;&lt;br /&gt;        } catch (IOException ex) {&lt;br /&gt;            ex.printStackTrace();&lt;br /&gt;        }&lt;br /&gt;        //asociate the keyboard listener with this JFrame&lt;br /&gt;        addKeyListener(this);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    @Override&lt;br /&gt;    public void paint(Graphics g) {&lt;br /&gt;        super.paint(g);&lt;br /&gt;        //draw brackground image (first image)&lt;br /&gt;        g.drawImage(background, 0, 0, this);&lt;br /&gt;        //draw bird image (second image, in this order)&lt;br /&gt;        g.drawImage(bird, cordX, cordY, this);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;        new MoveImage();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    //While a key is pressed&lt;br /&gt;    public void keyPressed(KeyEvent ke) {&lt;br /&gt;        switch (ke.getKeyCode()) {&lt;br /&gt;            //if the right arrow in keyboard is pressed...&lt;br /&gt;            case KeyEvent.VK_RIGHT: {&lt;br /&gt;                cordX+=3;&lt;br /&gt;            }&lt;br /&gt;            break;&lt;br /&gt;            //if the left arrow in keyboard is pressed...&lt;br /&gt;            case KeyEvent.VK_LEFT: {&lt;br /&gt;                cordX-=3;&lt;br /&gt;            }&lt;br /&gt;            break;&lt;br /&gt;            //if the down arrow in keyboard is pressed...&lt;br /&gt;            case KeyEvent.VK_DOWN: {&lt;br /&gt;                cordY+=3;&lt;br /&gt;            }&lt;br /&gt;            break;&lt;br /&gt;            //if the up arrow in keyboard is pressed...&lt;br /&gt;            case KeyEvent.VK_UP: {&lt;br /&gt;                cordY-=3;&lt;br /&gt;            }&lt;br /&gt;            break;&lt;br /&gt;        }&lt;br /&gt;        repaint();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    //When a key is typed (once)&lt;br /&gt;    public void keyTyped(KeyEvent ke) {}&lt;br /&gt;    &lt;br /&gt;    //When a key is released (typed or pressed)&lt;br /&gt;    public void keyReleased(KeyEvent ke) {}&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;Test the code and comment, thanks!.&lt;br /&gt;&lt;br /&gt;If you prefer the complete code source and resources in a &lt;a href=&quot;http://netbeans.org&quot; target=&quot;_BLANK&quot;&gt;Netbeans&lt;/a&gt; project, Download It &lt;a href=&quot;http://hotfile.com/dl/113808312/30f2f62/MoveImage.zip.html&quot; target=&quot;_BLANK&quot;&gt;Here!&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://mobile-programming-and-games.blogspot.com/feeds/2406153957186760471/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/04/move-image-inside-jframe-using-keyboard.html#comment-form' title='3 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/2406153957186760471'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/2406153957186760471'/><link rel='alternate' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/04/move-image-inside-jframe-using-keyboard.html' title='[Java] Move an image inside JFrame or Applet using keyboard!'/><author><name>Rene Cruz</name><uri>http://www.blogger.com/profile/01851511808569040242</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiISLhu6fJFJyqR6Eot7DWhwN2rrKUr2EfOMFMrlyl66ppozeYrjAvogdTdIjVEHwxf5oiWrW8TcoGy1mhfbZoT23ydwyakdv_2k0TWKhHNpPfOcfg-0oBCvEAU1S29/s220/6260_1193755199763_1104905006_30619832_37400_n.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXAQVk0iU_t_EiCeVnurhhD4Eop9i0XjHzc0B-FfT_Yk8zAeUHILu1Bc2xj5QxhwA_5F_p3Hu5Y0ivt_mvhDty28y0k28dkvWwOSHypa0hLQpVmNL0HGcz1iQzemdfErWHn7j6DOyfJsQ/s72-c/MoveImage.png" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7944280718515523707.post-3609000333696155198</id><published>2011-04-08T10:26:00.000-07:00</published><updated>2011-04-09T11:24:19.535-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="BufferedImage"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="JFrame"/><category scheme="http://www.blogger.com/atom/ns#" term="Load Images"/><title type='text'>[Java] First Steps: Load a PNG/JPG image in a JFrame</title><content type='html'>&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwfFIJYu_CNbmdJMEiMzOPEtr0IfXwk_qVtI3O36vPE0m8qWwes8xgTuh8VmxRn82Mi3rVSUIQRa3k7zBSpyYdmCd9AMhzMU0iLRTGUMMFuUHtRWFWNXrBCa9Dzc1DZo867R5owRP-cts/s1600/LoadImage.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 225px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwfFIJYu_CNbmdJMEiMzOPEtr0IfXwk_qVtI3O36vPE0m8qWwes8xgTuh8VmxRn82Mi3rVSUIQRa3k7zBSpyYdmCd9AMhzMU0iLRTGUMMFuUHtRWFWNXrBCa9Dzc1DZo867R5owRP-cts/s400/LoadImage.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5593276149364732786&quot; /&gt;&lt;/a&gt;&lt;br /&gt;Hi, this is one simple code for load and show an image inside a JFrame, using a BufferedImage to load image data from a specific local path (could be a URL if you prefer).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Steps:&lt;br /&gt;1.- Create a BufferedImage object.&lt;br /&gt;2.- Read the image file for a specific path&lt;br /&gt;3.- Draw the image in the screen using &quot;paint()&quot; method.&lt;br /&gt;&lt;br /&gt;That&#39;s it!&lt;br /&gt;&lt;pre class=&quot;brush: java&quot;&gt;package mx.gcross.samples;&lt;br /&gt;&lt;br /&gt;import java.awt.Graphics;&lt;br /&gt;import java.awt.image.BufferedImage;&lt;br /&gt;import java.io.File;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import javax.imageio.ImageIO;&lt;br /&gt;import javax.swing.JFrame;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author Rene Cruz - G-Cross Studio 2011&lt;br /&gt; */&lt;br /&gt;public class MyWindow extends JFrame {&lt;br /&gt;&lt;br /&gt;    //Object for image&lt;br /&gt;    private BufferedImage background;&lt;br /&gt;&lt;br /&gt;    public MyWindow() {&lt;br /&gt;&lt;br /&gt;        setSize(480, 320); //set window dimension 480x320px&lt;br /&gt;        loadImages();&lt;br /&gt;        setVisible(true); //make window visible&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void loadImages() {&lt;br /&gt;        try {&lt;br /&gt;            //path for image file&lt;br /&gt;            String path = &quot;images/background.png&quot;; &lt;br /&gt;            background = ImageIO.read(new File(path));&lt;br /&gt;        } catch (IOException ex) {&lt;br /&gt;            ex.printStackTrace();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    @Override&lt;br /&gt;    public void paint(Graphics g) {&lt;br /&gt;        super.paint(g);&lt;br /&gt;        //draw the bufferedImage object&lt;br /&gt;        g.drawImage(background, 0, 0, this); &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;        new MyWindow();&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;Test the code and comment, thanks!.&lt;br /&gt;&lt;br /&gt;If you prefer the complete code source and resources in a &lt;a href=&quot;http://netbeans.org&quot; target=&quot;_BLANK&quot;&gt;Netbeans&lt;/a&gt; project, Download It &lt;a href=&quot;http://hotfile.com/dl/113801553/aa74129/LoadImage.zip.html&quot; target=&quot;_BLANK&quot;&gt;Here!&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://mobile-programming-and-games.blogspot.com/feeds/3609000333696155198/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/04/first-steps-load-pngjpg-image-in-jframe.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/3609000333696155198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/3609000333696155198'/><link rel='alternate' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/04/first-steps-load-pngjpg-image-in-jframe.html' title='[Java] First Steps: Load a PNG/JPG image in a JFrame'/><author><name>Rene Cruz</name><uri>http://www.blogger.com/profile/01851511808569040242</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiISLhu6fJFJyqR6Eot7DWhwN2rrKUr2EfOMFMrlyl66ppozeYrjAvogdTdIjVEHwxf5oiWrW8TcoGy1mhfbZoT23ydwyakdv_2k0TWKhHNpPfOcfg-0oBCvEAU1S29/s220/6260_1193755199763_1104905006_30619832_37400_n.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwfFIJYu_CNbmdJMEiMzOPEtr0IfXwk_qVtI3O36vPE0m8qWwes8xgTuh8VmxRn82Mi3rVSUIQRa3k7zBSpyYdmCd9AMhzMU0iLRTGUMMFuUHtRWFWNXrBCa9Dzc1DZo867R5owRP-cts/s72-c/LoadImage.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7944280718515523707.post-5735775978164002489</id><published>2011-04-05T14:26:00.000-07:00</published><updated>2011-04-08T10:44:54.815-07:00</updated><title type='text'>First code!</title><content type='html'>Sample code for test SyntaxHighlighter:&lt;br /&gt;&lt;pre class=&quot;brush: java&quot;&gt;public class Hello {&lt;br /&gt;  public static void main(String args[]) {&lt;br /&gt;    System.out.println(&quot;Hello Blog World!&quot;);&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;That&#39;s it!</content><link rel='replies' type='application/atom+xml' href='http://mobile-programming-and-games.blogspot.com/feeds/5735775978164002489/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/04/first-code.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/5735775978164002489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/5735775978164002489'/><link rel='alternate' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/04/first-code.html' title='First code!'/><author><name>Rene Cruz</name><uri>http://www.blogger.com/profile/01851511808569040242</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiISLhu6fJFJyqR6Eot7DWhwN2rrKUr2EfOMFMrlyl66ppozeYrjAvogdTdIjVEHwxf5oiWrW8TcoGy1mhfbZoT23ydwyakdv_2k0TWKhHNpPfOcfg-0oBCvEAU1S29/s220/6260_1193755199763_1104905006_30619832_37400_n.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7944280718515523707.post-4160299426534609727</id><published>2011-04-05T13:20:00.000-07:00</published><updated>2011-04-05T13:48:21.477-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="iPhone"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Objective-C"/><category scheme="http://www.blogger.com/atom/ns#" term="Videogames"/><title type='text'>Welcome to my blog!</title><content type='html'>Hi, I hope that you can find interesting issues related with mobile programming and platforms,  and design and development of videogames too!&lt;br /&gt;&lt;br /&gt;All the examples try to explain several topics from basics to advanced technics.&lt;br /&gt;&lt;br /&gt;The examples are related with:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;J2ME, J2SE y Bluetooth&lt;/li&gt;&lt;li&gt;Android&lt;br /&gt;&lt;/li&gt;&lt;li&gt;iPhone, iPad y iPod&lt;/li&gt;&lt;li&gt;Blackberry&lt;/li&gt;&lt;li&gt;Palm WebOS&lt;/li&gt;&lt;li&gt;Windows 7 Mobile&lt;/li&gt;&lt;li&gt;XBox 360&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Also, we will explain another examples of specific issues related with videogames development in the follow lenguages:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;C/C++&lt;/li&gt;&lt;li&gt;Java&lt;/li&gt;&lt;li&gt;C#&lt;/li&gt;&lt;li&gt;Objective-C&lt;/li&gt;&lt;li&gt;PHP&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;All examples placed here are not tutorials or courses, however includes the complete code source of each example.&lt;br /&gt;&lt;br /&gt;So, Enjoy and comment!</content><link rel='replies' type='application/atom+xml' href='http://mobile-programming-and-games.blogspot.com/feeds/4160299426534609727/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/04/bienvenidos-al-blog.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/4160299426534609727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7944280718515523707/posts/default/4160299426534609727'/><link rel='alternate' type='text/html' href='http://mobile-programming-and-games.blogspot.com/2011/04/bienvenidos-al-blog.html' title='Welcome to my blog!'/><author><name>Rene Cruz</name><uri>http://www.blogger.com/profile/01851511808569040242</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiISLhu6fJFJyqR6Eot7DWhwN2rrKUr2EfOMFMrlyl66ppozeYrjAvogdTdIjVEHwxf5oiWrW8TcoGy1mhfbZoT23ydwyakdv_2k0TWKhHNpPfOcfg-0oBCvEAU1S29/s220/6260_1193755199763_1104905006_30619832_37400_n.jpg'/></author><thr:total>0</thr:total></entry></feed>