diff --git a/APL2.1/TP9/Volume/Fenetre.class b/APL2.1/TP9/Volume/Fenetre.class new file mode 100644 index 0000000..632933c Binary files /dev/null and b/APL2.1/TP9/Volume/Fenetre.class differ diff --git a/APL2.1/TP9/Volume/Fenetre.java b/APL2.1/TP9/Volume/Fenetre.java index 14f35eb..8417c08 100644 --- a/APL2.1/TP9/Volume/Fenetre.java +++ b/APL2.1/TP9/Volume/Fenetre.java @@ -11,7 +11,7 @@ public class Fenetre extends JFrame { JPanel panneau = new JPanel(); panneau.addMouseWheelListener(new Souris(draw)); panneau.add(draw); - panneau.setBackground (Color.BLUE); + panneau.setBackground (Color.BLACK); this.add(panneau, BorderLayout.CENTER); this.pack(); diff --git a/APL2.1/TP9/Volume/Paintvolume.class b/APL2.1/TP9/Volume/Paintvolume.class new file mode 100644 index 0000000..bc626de Binary files /dev/null and b/APL2.1/TP9/Volume/Paintvolume.class differ diff --git a/APL2.1/TP9/Volume/Paintvolume.java b/APL2.1/TP9/Volume/Paintvolume.java new file mode 100644 index 0000000..c5edcdb --- /dev/null +++ b/APL2.1/TP9/Volume/Paintvolume.java @@ -0,0 +1,42 @@ +import javax.swing.*; +import java.awt.event.*; +import java.awt.*; + +public class Paintvolume extends JComponent { + private int volume = 5; + public Paintvolume() { + super(); + this.setPreferredSize(new Dimension(500, 100)); + } + + public void upVolume() { + if (volume != 9) { + volume++; + this.repaint(); + } + } + public void downVolume() { + if (volume != 0) { + volume--; + this.repaint(); + } + } + + @Override + protected void paintComponent(Graphics pinceau) { + Graphics secondPinceau = pinceau.create(); + if (this.isOpaque()) { + secondPinceau.setColor(this.getBackground()); + secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight()); + } + secondPinceau.setColor(Color.ORANGE); + int x1, x2; + for (x1 = 0; x1