IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

2D Java Discussion :

Pourquoi mon image ne s'affiche plus


Sujet :

2D Java

  1. #1
    Membre expérimenté
    Avatar de Gouyon
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2003
    Messages
    1 094
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : France, Loiret (Centre)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Novembre 2003
    Messages : 1 094
    Points : 1 530
    Points
    1 530
    Billets dans le blog
    5
    Par défaut Pourquoi mon image ne s'affiche plus
    Salut

    Voilà je me lance dans Java et j'ai commencé une petite application avec Eclipse sous Linux (ubuntu 10.10) qui fonctionne. J'ai importé mon projet avec Eclipse (window7 64 bits) et là ça marche plus

    Le soucis vient surtout du fait que les images ne sont plus affichées voilà ce que je fais:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
     
    public class JPlateau extends JPanel {
     
    	private BufferedImage Damier;
     
    	// Constructeur
     
    	public JPlateau() {
    		super();		
    		try {
    			Damier = ImageIO.read(new File("Graph/Damier.png"));			
    		} catch (IOException e) {
    			System.out.println("Erreur chargement damier");
    		}
    	}
     
    	@Override
    	public void paintComponent(final Graphics g) {
     
    		super.paintComponent(g);
     
    		g.drawImage(Damier, 0, 0, 1088, 576, 0, 0, 1088, 576, null);
     
    	}
     
    }
    Ma classe fenêtre
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
     
    public class MainFen extends JFrame implements MouseListener{
     
    	private JPlateau Plateau;
     
    	public MainFen() {
    		super();
    		build();
    		// MAJ();
    	}
     
    	private void build() {
    		setTitle("Ritmomachie");
    		setSize(1240, 860);
    		setMinimumSize(new Dimension(1240,860));
    		setLocationRelativeTo(null);
    		setResizable(true);
    		addMouseListener(this);
    		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		setContentPane(buildContentPane());
    		MenuBar MainMenu=new MenuBar();
    		setMenuBar(MainMenu);
    		Menu Partie= new Menu("Partie");
    		MainMenu.add(Partie);
    		MenuItem Nouvelle=new MenuItem("Nouvelle");
    		Partie.add(Nouvelle);
    		MenuItem Charger=new MenuItem("Charger");
    		Partie.add(Charger);
    		MenuItem Sauver=new MenuItem("Sauver");
    		Partie.add(Sauver);
     
    	}
     
    	private JPanel buildContentPane() {
    		Plateau = new JPlateau();
    		return Plateau;
    	}
     
     
    	@Override
    	public void mouseClicked(MouseEvent e) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void mouseEntered(MouseEvent e) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void mouseExited(MouseEvent e) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void mousePressed(MouseEvent e) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void mouseReleased(MouseEvent e) {
    		// TODO Auto-generated method stub
     
    	}
     
    }
    et ma classe principale
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
     
    public class Rithmomachie {
     
    	/**
             * @param args
             */
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    		SwingUtilities.invokeLater(new Runnable(){
    			public void run(){
    				MainFen MaFen = new MainFen();
    				MaFen.setVisible(true);
    			}
    		});
    	}
     
    }
    Si quelqu'un a une idée?

  2. #2
    Expert éminent sénior
    Avatar de adiGuba
    Homme Profil pro
    Développeur Java/Web
    Inscrit en
    Avril 2002
    Messages
    13 938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Java/Web
    Secteur : Transports

    Informations forums :
    Inscription : Avril 2002
    Messages : 13 938
    Points : 23 190
    Points
    23 190
    Billets dans le blog
    1
    Par défaut
    Salut,


    Y-a-t'il une exception ?
    Si oui il serait préférable de l'afficher...


    a++

  3. #3
    Membre expérimenté
    Avatar de Gouyon
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2003
    Messages
    1 094
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : France, Loiret (Centre)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Novembre 2003
    Messages : 1 094
    Points : 1 530
    Points
    1 530
    Billets dans le blog
    5
    Par défaut
    A priori non mais quand je termine l'exécution dans la fenêtre console j'ai ça
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
     
    Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: sun.awt.image.BufImgSurfaceData.initIDs()V
    	at sun.awt.image.BufImgSurfaceData.initIDs(Native Method)
    	at sun.awt.image.BufImgSurfaceData.<clinit>(Unknown Source)
    	at sun.awt.image.CachingSurfaceManager.<init>(Unknown Source)
    	at sun.java2d.d3d.D3DCachingSurfaceManager.<init>(Unknown Source)
    	at sun.java2d.SurfaceManagerFactory.createCachingManager(Unknown Source)
    	at sun.awt.image.SurfaceManager.getManager(Unknown Source)
    	at sun.java2d.SurfaceData.getSourceSurfaceData(Unknown Source)
    	at sun.java2d.pipe.DrawImage.renderImageCopy(Unknown Source)
    	at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
    	at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
    	at sun.java2d.pipe.ValidatePipe.copyImage(Unknown Source)
    	at sun.java2d.SunGraphics2D.copyImage(Unknown Source)
    	at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
    	at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
    	at Jeu.JPlateau.paintComponent(JPlateau.java:44)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JLayeredPane.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paintToOffscreen(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
    	at javax.swing.RepaintManager.paint(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
    	at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
    	at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
    	at java.awt.Container.paint(Unknown Source)
    	at java.awt.Window.paint(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
    	at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
    	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: Could not initialize class sun.awt.image.BufImgSurfaceData
    	at sun.awt.image.CachingSurfaceManager.<init>(Unknown Source)
    	at sun.java2d.d3d.D3DCachingSurfaceManager.<init>(Unknown Source)
    	at sun.java2d.SurfaceManagerFactory.createCachingManager(Unknown Source)
    	at sun.awt.image.SurfaceManager.getManager(Unknown Source)
    	at sun.java2d.SurfaceData.getSourceSurfaceData(Unknown Source)
    	at sun.java2d.pipe.DrawImage.renderImageCopy(Unknown Source)
    	at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
    	at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
    	at sun.java2d.pipe.ValidatePipe.copyImage(Unknown Source)
    	at sun.java2d.SunGraphics2D.copyImage(Unknown Source)
    	at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
    	at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
    	at Jeu.JPlateau.paintComponent(JPlateau.java:44)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JLayeredPane.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paintToOffscreen(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
    	at javax.swing.RepaintManager.paint(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
    	at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
    	at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
    	at java.awt.Container.paint(Unknown Source)
    	at java.awt.Window.paint(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
    	at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
    	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)

  4. #4
    Expert éminent sénior
    Avatar de adiGuba
    Homme Profil pro
    Développeur Java/Web
    Inscrit en
    Avril 2002
    Messages
    13 938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Java/Web
    Secteur : Transports

    Informations forums :
    Inscription : Avril 2002
    Messages : 13 938
    Points : 23 190
    Points
    23 190
    Billets dans le blog
    1
    Par défaut
    Ben tu as une exception... Il faut la corriger !


    Apparemment il ne trouve pas une librairie native du JRE...
    Quelle version de java utilises-tu ?

    a++

  5. #5
    Membre expérimenté
    Avatar de Gouyon
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2003
    Messages
    1 094
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : France, Loiret (Centre)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Novembre 2003
    Messages : 1 094
    Points : 1 530
    Points
    1 530
    Billets dans le blog
    5
    Par défaut
    A priori c'est la JSE 1.6 (jre6)

  6. #6
    Membre expérimenté
    Avatar de Gouyon
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2003
    Messages
    1 094
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : France, Loiret (Centre)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Novembre 2003
    Messages : 1 094
    Points : 1 530
    Points
    1 530
    Billets dans le blog
    5
    Par défaut
    Finalement j'ai résolu le problème. J'ai SAUVAGEMENT désinstallé java, éclipse. J'ai ensuite installé le JDK et Eclipse mais version 32 bits et là ça a fonctionné.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. pourquoi mon image ne s'affiche pas sur IE
    Par Ercan67000 dans le forum Balisage (X)HTML et validation W3C
    Réponses: 2
    Dernier message: 22/06/2011, 12h31
  2. pourquoi mon image ne s'affiche pas
    Par zalalus dans le forum Windows Presentation Foundation
    Réponses: 7
    Dernier message: 20/05/2011, 11h42
  3. Les images ne s'affiche plus dans Mozilla Firefox
    Par sondo dans le forum Windows XP
    Réponses: 17
    Dernier message: 19/11/2008, 22h46
  4. les icones mon bureau ne s'affichent plus
    Par bambi98 dans le forum Windows XP
    Réponses: 5
    Dernier message: 29/10/2007, 14h23
  5. mon image ne s'affiche pas
    Par vinc_dev_fr dans le forum AWT/Swing
    Réponses: 2
    Dernier message: 19/05/2007, 21h08

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo