Commit 794d8c57 authored by Baptiste Fournier's avatar Baptiste Fournier

added logo CS

parent fa0187b2
File added
No preview for this file type
No preview for this file type
import javax.swing.*;
import java.awt.*;
import java.awt.image.*;
import javax.imageio.*;
import java.io.*;
public class MonDessin extends JPanel {
Image myImage;
BufferedImage img = null;
Color rectangleColor = Color.red;
public MonDessin() {
// TODO Auto-generated constructor stub
try {
img = ImageIO.read(new File("logo-CS-blanc.png"));
} catch (IOException e) {
}
}
public MonDessin(LayoutManager layout) {
......@@ -22,7 +31,8 @@ public class MonDessin extends JPanel {
// TODO Auto-generated constructor stub
}
public void paint(Graphics g){
g.setColor(Color.blue);
g.fillRect(20, 10, 40, 30);
g.setColor(rectangleColor);
g.fillRect(10, 10, 600, 300);
g.drawImage(img, 20,20,null);
}
}
......@@ -9,12 +9,15 @@ public class TestSwing {
*/
public static void main(String[] args) {
JFrame MainFrame = new JFrame();
Dimension preferredSize = new Dimension(100,100);
Dimension preferredSize = new Dimension(1000,1000);
MainFrame.setPreferredSize(preferredSize);
MainFrame.setTitle("Graphisme avec Swing");
MainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
MainFrame.pack();
MainFrame.setVisible(true);
MonDessin dessin = new MonDessin();
MainFrame.add(dessin);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment