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