tp dev liste c pas fini :/
This commit is contained in:
parent
a7d3b4e407
commit
d2341e4a24
15
DEV3.2/Listes/Luminance/src/forme.java
Normal file
15
DEV3.2/Listes/Luminance/src/forme.java
Normal file
@ -0,0 +1,15 @@
|
||||
import java.awt.*;
|
||||
|
||||
public class forme {
|
||||
public static void parallelogramme(Graphics g, int x, int y, Color c)
|
||||
{
|
||||
int [] xP = {x+0, x+50, x+100, x+50};
|
||||
int [] yP = {y+0, y+100, y+100, y+0};
|
||||
//Polygon p = new Polygon();
|
||||
g.setColor(Color.BLACK);
|
||||
g.drawPolygon(xP,yP,4);
|
||||
g.setColor(c);
|
||||
g.fillPolygon(xP,yP,4);
|
||||
}
|
||||
|
||||
}
|
41
DEV3.2/Listes/Luminance/src/main.java
Normal file
41
DEV3.2/Listes/Luminance/src/main.java
Normal file
@ -0,0 +1,41 @@
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.swing.*;
|
||||
import java.util.Random;
|
||||
|
||||
class main extends JPanel
|
||||
{
|
||||
public void paintComponent(Graphics G)
|
||||
{
|
||||
Random rand = new Random();
|
||||
int x = 50;
|
||||
int y = 50;
|
||||
List<Color> couleur = new ArrayList<Color> ();
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
couleur.add(i,new Color(rand.nextInt(255),rand.nextInt(255),rand.nextInt(255)));
|
||||
}
|
||||
|
||||
for (int i = 0; i < couleur.size(); i++) {
|
||||
forme.parallelogramme(G, x, y, couleur.get(i));
|
||||
x+=60;
|
||||
}
|
||||
|
||||
//Polygon p = new Polygon();
|
||||
//g.fillPolygon(p);
|
||||
}
|
||||
public static void main( String args[] )
|
||||
{
|
||||
JFrame frame = new JFrame();
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setBackground(Color.white);
|
||||
frame.setSize(750, 250);
|
||||
|
||||
main panel = new main();
|
||||
|
||||
frame.add(panel);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
}
|
BIN
DEV3.2/Recursivité/build/appel.class
Normal file
BIN
DEV3.2/Recursivité/build/appel.class
Normal file
Binary file not shown.
20
DEV3.2/Recursivité/src/appel.java
Normal file
20
DEV3.2/Recursivité/src/appel.java
Normal file
@ -0,0 +1,20 @@
|
||||
public class appel {
|
||||
|
||||
private static int factorielle(int x)
|
||||
{
|
||||
if( x > 1)
|
||||
{
|
||||
return x*factorielle(x-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
int y = factorielle(Integer.parseInt(args[0]));
|
||||
System.out.println(y);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user