A voir également:
- Jeu avec java
- Jeux java itel - Télécharger - Jeux vidéo
- Waptrick java football - Télécharger - Jeux vidéo
- Waptrick java voiture - Télécharger - Jeux vidéo
- Eclipse java - Télécharger - Langages
- Java apk - Télécharger - Langages
1 réponse
Il faut créer un Component dont tu redéfinis la méthode void paint(Graphics)
Regarde la documentation de Graphics pour voir les méthodes disponibles.
Ensuite tu crées une fenêtre (JFrame, Applet, ou autre) pour mettre ton composant.
Exemple :
Regarde la documentation de Graphics pour voir les méthodes disponibles.
Ensuite tu crées une fenêtre (JFrame, Applet, ou autre) pour mettre ton composant.
Exemple :
public class Cadre extends java.awt.Component
{
private static final long serialVersionUID = 1;
@Override
public void paint(java.awt.Graphics g)
{
super.paint(g);
g.drawOval(0, 0, getWidth(), getHeight());
}
}
public class Test
{
public static void main(String[] args)
{
Cadre cadre = new Cadre();
javax.swing.JFrame frame = new javax.swing.JFrame();
frame.add(cadre);
frame.setSize(200+16,200+38);
frame.setVisible(true);
frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
}
}La confiance n'exclut pas le contrôle