0% found this document useful (0 votes)
7 views1 page

Java Swing Window and Panel Example

The document contains Java code for a simple GUI application consisting of three classes: Test, fenetre, and Panneau. The Test class creates a fenetre instance, which is a JFrame that sets up a window with a title and size. The Panneau class extends JPanel and overrides the paintComponent method to draw a string on the panel when rendered.

Uploaded by

lucagbidime05
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Java Swing Window and Panel Example

The document contains Java code for a simple GUI application consisting of three classes: Test, fenetre, and Panneau. The Test class creates a fenetre instance, which is a JFrame that sets up a window with a title and size. The Panneau class extends JPanel and overrides the paintComponent method to draw a string on the panel when rendered.

Uploaded by

lucagbidime05
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

CLASSE Test

public class Test {


public static void main(String[] args) {
fenetre fen = new fenetre();
}
}

---------------------------------------------------------------------
CLASSE fenetre

import [Link];;

public class fenetre extends JFrame {

public fenetre(){
[Link]("Ma première fenêtre Java");
[Link](100, 150);
[Link](null);
[Link](JFrame.EXIT_ON_CLOSE);
[Link](new Panneau());

[Link](true);
}

------------------------------------------------------------------------
CLASSE Panneau

import [Link];
import [Link];

public class Panneau extends JPanel {


public void paintComponent (Graphics g) {
[Link]("Je suis exécutée !");
[Link]("Wow ice !", 15, 15);

}
}

/*
import [Link];
import [Link];
public class Panneau extends JPanel {
public void paintComponent(Graphics g){
//x1, y1, width, height, arcWidth, arcHeight
[Link](10, 10, 30, 50, 10, 10);
[Link](55, 65, 55, 30, 5, 5);
}
}
*/

You might also like