Ajout des travaux effectuer
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
|
||||
public class Conversion
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Couleur extends JComponent
|
||||
{
|
||||
protected void paintComponent(Graphics g)
|
||||
{
|
||||
Graphics secondPinceau = g.create();
|
||||
secondPinceau.setColor(Color.getColor());
|
||||
Polygon poly1 = new Polygon();
|
||||
poly1.addPoint(0,0);
|
||||
poly1.addPoint(this.getWidth(), 0);
|
||||
poly1.addPoint(this.getWidth(), this.getHeight());
|
||||
secondPinceau.fillPolygon(poly1);
|
||||
secondPinceau.setColor(Color.getColor());
|
||||
Polygon poly2 = new Polygon();
|
||||
poly2.addPoint(0, 0);
|
||||
poly2.addPoint(0, this.getHeight());
|
||||
poly2.addPoint(this.getWidth(), this.getHeight());
|
||||
secondPinceau.fillPolygon(poly2);
|
||||
}
|
||||
public String getColor(){
|
||||
try
|
||||
{
|
||||
FileReader fr = new FileReader("rgb.txt");
|
||||
StringReader sr = new StringReader(fr);
|
||||
try
|
||||
{
|
||||
sr.close();
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
System.out.println("Erreur de fermeture");
|
||||
}
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
System.out.println("Erreur d'ouverture");
|
||||
}
|
||||
}
|
||||
public Couleur()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class TestCouleur
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(400, 400);
|
||||
fenetre.setLocation(100, 100);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
Couleur coul = new Couleur();
|
||||
fenetre.add(coul);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
MIDNIGHTBLUE
|
||||
BLANCHEDALMOND
|
||||
Reference in New Issue
Block a user