Java codeimport java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JPanel;
public class Circle extends JPanel{
public int value;
public Circle(){
}
public Circle(int value){
this.value = value;
}
public int getValue(){
return value;
}
public void setValue(int value){
this.value = value;
repaint();
}
protected void paintComponent(Graphics g){
super.paintComponent(g);
int clockRadius = (int)(Math.min(getWidth(), getHeight())*0.8*0.5);
int xCenter = getWidth()/2;
int yCenter = getHeight()/2;
g.setColor(Color.RED);
g.drawOval(xCenter-clockRadius, yCenter-clockRadius, 2*clockRadius, 2*clockRadius);
int line1 = (int)(clockRadius);
int line1X = (int) (xCenter-clockRadius*Math.cos(value*(2*Math.PI/60)));
int line1Y = yCenter+value;
g.drawLine(xCenter, yCenter, line1X, line1Y);
}
public Dimension getPreferredSize() {
return new Dimension(100,100);
}
}