Ajouter un commentaire

Niroken

Hello,

Ton code ne marche pas parce qu'il manque pas mal d'éléments pour le faire fonctionner.

Voici un exemple simple qui marche :

package graphic;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;

import javax.swing.JFrame;

public class TestFrameWithPaint extends JFrame{
	
	private static final long serialVersionUID = 1L;

	public TestFrameWithPaint() {
		setTitle("TankGame");
        setLayout(new FlowLayout());
        setSize(new Dimension(500, 500));
        
        setVisible(true);
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	}
	
	public void paint(Graphics g) { 
		super.paint(g);
		
		g.setColor(Color.BLACK);
		g.drawLine(10,20,30,40);
		String text="hello"; 
		g.drawString(text,60,100); 
	}		
	
}

Bonne chance,
Niroken

Filtered HTML

Plain text

CAPTCHA
Cette question permet de vérifier que vous n'êtes pas un robot spammeur :-)
 L      SSS   W     W  RRRR   M   M 
L S W W R R MM MM
L SSS W W W RRRR M M M
L S W W W R R M M
LLLL SSSS W W R RR M M