Ajout des travaux effectuer
This commit is contained in:
BIN
23DEV1.1/TPS2/TP01/Evènements/AttTest.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Evènements/AttTest.class
Normal file
Binary file not shown.
17
23DEV1.1/TPS2/TP01/Evènements/AttTest.java
Normal file
17
23DEV1.1/TPS2/TP01/Evènements/AttTest.java
Normal 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);
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Evènements/Attente.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Evènements/Attente.class
Normal file
Binary file not shown.
53
23DEV1.1/TPS2/TP01/Evènements/Attente.java
Normal file
53
23DEV1.1/TPS2/TP01/Evènements/Attente.java
Normal 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();
|
||||
}
|
||||
}
|
||||
35
23DEV1.1/TPS2/TP01/Evènements/Evènement2/Playlist.java
Normal file
35
23DEV1.1/TPS2/TP01/Evènements/Evènement2/Playlist.java
Normal 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();
|
||||
}
|
||||
}
|
||||
18
23DEV1.1/TPS2/TP01/Evènements/Evènement2/TestPlaylist.java
Normal file
18
23DEV1.1/TPS2/TP01/Evènements/Evènement2/TestPlaylist.java
Normal 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);
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Evènements/Evènement2/TestVolume.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Evènements/Evènement2/TestVolume.class
Normal file
Binary file not shown.
15
23DEV1.1/TPS2/TP01/Evènements/Evènement2/TestVolume.java
Normal file
15
23DEV1.1/TPS2/TP01/Evènements/Evènement2/TestVolume.java
Normal 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);
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Evènements/Evènement2/Volume.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Evènements/Evènement2/Volume.class
Normal file
Binary file not shown.
44
23DEV1.1/TPS2/TP01/Evènements/Evènement2/Volume.java
Normal file
44
23DEV1.1/TPS2/TP01/Evènements/Evènement2/Volume.java
Normal 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();
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Evènements/Fond.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Evènements/Fond.class
Normal file
Binary file not shown.
38
23DEV1.1/TPS2/TP01/Evènements/Fond.java
Normal file
38
23DEV1.1/TPS2/TP01/Evènements/Fond.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Evènements/RadTest.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Evènements/RadTest.class
Normal file
Binary file not shown.
15
23DEV1.1/TPS2/TP01/Evènements/RadTest.java
Normal file
15
23DEV1.1/TPS2/TP01/Evènements/RadTest.java
Normal 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);
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Evènements/Radio.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Evènements/Radio.class
Normal file
Binary file not shown.
37
23DEV1.1/TPS2/TP01/Evènements/Radio.java
Normal file
37
23DEV1.1/TPS2/TP01/Evènements/Radio.java
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Evènements/Test.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Evènements/Test.class
Normal file
Binary file not shown.
15
23DEV1.1/TPS2/TP01/Evènements/Test.java
Normal file
15
23DEV1.1/TPS2/TP01/Evènements/Test.java
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user