Cours java debutant
<span class="mw-headline" id="Cours_java_debutant« >Cours java debutant

Pour cette troisième entrée dans notre série ‘boost’, nous abordons le chargement asynchrone d’une image. Notre objectif: être affiché dans une application Java sur l’image dans le dossier de celui-ci – ici, nous allons afficher le logo du JDN Développeurs …
[File ChargerImage.java] import java.awt .*; import java.awt.event .*; import javax.swing .*; classe ChargerImage public {public static void main (String [] args) {fenêtre Window = new Window ( ) fenetre.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); fenetre.show ();}} classe Window extends JFrame {public Window () {conteneur = leContenant getContentPane (); leContenant.setLayout (FlowLayout nouvelle ()); image AffichageImage = AffichageImage nouvelles (‘logo_jdn_developpeurs.gif’); leContenant.add (image);}} classe étend Canvas {AffichageImageSize = Toolkit.getDefaultToolkit taille de l’écran (). GetScreenSize (); int = screenSize.width screenwidth; int = screenSize.height hauteurEcran; image Image; public AffichageImage (String url) {image = getToolkit (). GetImage (url); prepareImage (image, this);} public void peinture (Graphics g) {g.drawImage (image, 0, 0, this);} public boolean imageUpdate (image Image, info int, int x, y int, , int l, int h) {if ((info