DEV/DEV2.1/TP7/Polygone.java

35 lines
933 B
Java
Raw Normal View History

2023-05-09 11:23:33 +02:00
import javax.swing.*;
import java.awt.*;
import java.io.*;
public class Polygone extends JPanel
{
public static void main(String[] args) {
try
{
int[] xPoints = new int[100]; // Coordonnées x des sommets du polygone
int[] yPoints = new int[100]; // Coordonnées y des sommets du polygone
FileInputStream fis = new FileInputStream("./polygone.bin");
DataInputStream dis = new DataInputStream(fis);
int i = 0;
while(dfgxfd!=-1);
{
xPoints[i] = dis.readInt();
}
dis.close();
}
catch(IOException e)
{
System.out.println("probleme de lecture");
}
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(300, 300);
Polygoneur poly = new Polygoneur(xPoints,yPoints);
frame.add(poly);
frame.setVisible(true);
}
}