Ajout des travaux effectuer

This commit is contained in:
2024-12-09 11:53:11 +01:00
parent 05fac8d3ae
commit c4e97e13da
558 changed files with 67900 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,17 @@
import javax.swing.*;
import java.awt.*;
public class AttTest {
public static void main(String[] args)
{
JFrame fenetre = new JFrame();
fenetre.setSize(400, 400);
fenetre.setLocation(100, 100);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Attente att = new Attente();
fenetre.add(att);
fenetre.addWindowListener(att);
fenetre.setVisible(true);
}
}

Binary file not shown.

View File

@@ -0,0 +1,53 @@
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Attente extends JComponent implements WindowListener
{
boolean plan = true;
protected void paintComponent(Graphics g)
{
Graphics secondPinceau = g.create();
if (this.isOpaque()){
secondPinceau.setColor(this.getBackground());
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
}
secondPinceau.setColor(Color.GREEN);
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
if (plan == true){
secondPinceau.setColor(Color.RED);
secondPinceau.fillOval(100, 90, 200, 200);
}
if (plan == false){
secondPinceau.setColor(Color.CYAN);
Polygon poly1 = new Polygon();
poly1.addPoint(0,0);
poly1.addPoint(this.getWidth(), 0);
poly1.addPoint(this.getWidth()/2, this.getHeight()/2);
secondPinceau.fillPolygon(poly1);
Polygon poly2 = new Polygon();
poly2.addPoint(this.getWidth()/2, this.getHeight()/2);
poly2.addPoint(0, this.getHeight());
poly2.addPoint(this.getWidth(), this.getHeight());
secondPinceau.fillPolygon(poly2);
}
}
public void windowActivated(WindowEvent evenement)
{
plan = true;
this.repaint();
}
public void windowClosed(WindowEvent evenement){}
public void windowClosing(WindowEvent evenement){}
public void windowDeactivated(WindowEvent evenement)
{
plan = false;
this.repaint();
}
public void windowDeiconified(WindowEvent evenement){}
public void windowIconified(WindowEvent evenement){}
public void windowOpened(WindowEvent evenement){}
public Attente(){
super();
}
}

View File

@@ -0,0 +1,35 @@
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.event.MouseWheelEvent;
import javax.swing.JComponent;
public class Playlist extends JComponent implements MouseWheelListener
{
int n = 0;
int x = 70;
protected void paintComponent(Graphics pinceau)
{
Graphics secondPinceau = pinceau.create();
if (this.isOpaque()) {
secondPinceau.setColor(this.getBackground());
secondPinceau.drawRect(0, 0, getWidth(), getHeight());
}
for(int i = 0 ; i <10 ; i++)
{
secondPinceau.setColor(Color.GRAY);
secondPinceau.fillOval(x+10, 130, 70, 70);
x = x+90;
}
for(int i = 0 ; i <n ; i++)
{
secondPinceau.setColor(Color.YELLOW);
secondPinceau.fillOval(x+10, 130, 70, 70);
x = x+90;
}
}
public Playlist(){
super();
}
}

View File

@@ -0,0 +1,18 @@
import javax.swing.*;
import java.awt.*;
public class TestPlaylist
{
public static void main(String[] args)
{
JFrame fenetre = new JFrame();
fenetre.setSize(1000, 300);
fenetre.setLocation(100, 100);
fenetre.setBackground(Color.GREY);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Playlist p = new Playlist();
p.add();
fenetre.setVisible(true);
}
}

View File

@@ -0,0 +1,15 @@
import javax.swing.*;
import java.awt.*;
public class TestVolume
{
public static void main(String[] args)
{
JFrame fenetre = new JFrame();
fenetre.setSize(1000, 300);
fenetre.setLocation(100, 100);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fenetre.add(new Volume());
fenetre.setVisible(true);
}
}

View File

@@ -0,0 +1,44 @@
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.event.MouseWheelEvent;
import javax.swing.JComponent;
public class Volume extends JComponent implements MouseWheelListener
{
int x = 0;
int nbrClic = 0;
protected void paintComponent(Graphics pinceau)
{
Graphics secondPinceau = pinceau.create();
secondPinceau.setColor(Color.DARK_GRAY);
secondPinceau.fillRect(0,0,this.getWidth(), this.getHeight());
for(int i = 0 ; i < 10 ; i++)
{
secondPinceau.setColor(Color.GRAY);
secondPinceau.fillOval(x, 50, 70, 70);
x = x+60;
}
for(int i = 0 ; i < this.nbrClic ; i++)
{
secondPinceau.setColor(Color.YELLOW);
secondPinceau.fillOval(x, 50, 70, 70);
x = x+60;
}
}
public void mouseWheelMoved(MouseWheelEvent evenement)
{
this.nbrClic = evenement.getWheelRotation();
this.repaint();
if(this.nbrClic>=10){
nbrClic++;
}
if(this.nbrClic<=0){
nbrClic--;
}
}
public Volume(){
super();
}
}

Binary file not shown.

View File

@@ -0,0 +1,38 @@
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Fond extends JPanel implements ActionListener
{
public Fond()
{
super();
JButton cyan = new JButton("Cyan");
JButton magenta = new JButton("Magenta");
JButton jaune = new JButton("Jaune");
this.add(cyan);
this.add(magenta);
this.add(jaune);
cyan.addActionListener(this);
magenta.addActionListener(this);
jaune.addActionListener(this);
}
public void actionPerformed(ActionEvent evenement)
{
String test;
test = evenement.getActionCommand();
if(test.equals("Cyan"))
{
this.setBackground(Color.CYAN);
}
if(test.equals("Magenta"))
{
this.setBackground(Color.MAGENTA);
}
if(test.equals("Jaune"))
{
this.setBackground(Color.YELLOW);
}
}
}

Binary file not shown.

View File

@@ -0,0 +1,15 @@
import javax.swing.*;
import java.awt.*;
public class RadTest {
public static void main(String[] args)
{
JFrame fenetre = new JFrame();
fenetre.setSize(200, 200);
fenetre.setLocation(100, 100);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fenetre.add(new Radio());
fenetre.setVisible(true);
}
}

Binary file not shown.

View File

@@ -0,0 +1,37 @@
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Radio extends JPanel implements ActionListener
{
public Radio()
{
super();
JRadioButton cyan = new JRadioButton("Cyan");
JRadioButton magenta = new JRadioButton("Magenta");
JRadioButton jaune = new JRadioButton("Jaune");
this.add(cyan);
this.add(magenta);
this.add(jaune);
cyan.addActionListener(this);
magenta.addActionListener(this);
jaune.addActionListener(this);
}
public void actionPerformed(ActionEvent evenement)
{
String test;
test = evenement.getActionCommand();
if(test.equals("Cyan"))
{
this.setBackground(Color.CYAN);
}
if(test.equals("Magenta"))
{
this.setBackground(Color.MAGENTA);
}
if(test.equals("Jaune"))
{
this.setBackground(Color.YELLOW);
}
}
}

Binary file not shown.

View File

@@ -0,0 +1,15 @@
import javax.swing.*;
import java.awt.*;
public class Test {
public static void main(String[] args)
{
JFrame fenetre = new JFrame();
fenetre.setSize(200, 200);
fenetre.setLocation(100, 100);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fenetre.add(new Fond());
fenetre.setVisible(true);
}
}