Background
Im Total Java newbie, today I started learning it (from thenewboston.org ). I already know how to create simple windows / forms / gui, draw lines, etc.
My goal is to create in Java gauge as follows:

This is a metric that I created in .NET C # WPF, and now I want to rewrite it in Java.
The main question :
How to create a triangle or other shape with some transparency and rotate it?
I tried to draw something using a Graphics object as follows:
public void paint(Graphics g){ g.drawLine(0, 0, 100, 100); }
But I think that this is the wrong direction, because when I impose something on the schedule, it just stays there, I can’t move or rotate it.
Do I need to clear all the graphics and draw it again to make an “animation”, or is there an easier way?
Edit: I already know how to smooth ( Hovercraft Full Eels already helped me with this - thanks).
Edit2:
My code looks something like this:
import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.RenderingHints; import javax.swing.JFrame; import javax.swing.JPanel; public class MainWindow extends JPanel { private Point p1 = new Point(100, 100); private Point p2 = new Point(740, 450); public MainWindow() { this.setPreferredSize(new Dimension(800, 600)); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); drawLines(g); } private void drawLines(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.DARK_GRAY); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setStroke(new BasicStroke(4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); g.drawLine(p1.x, p1.y, p2.x, p2.y); } private void display() { JFrame f = new JFrame("Main Window"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(this); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); } public static void main(String[] args) { new MainWindow().display(); } }