Java tutorial
import java.awt.Color; import java.awt.Graphics; import javax.swing.JFrame; import javax.swing.JPanel; public class MainClass extends JPanel { public void paint(Graphics g) { int n = 3; int xdata[] = new int[n]; int ydata[] = new int[n]; xdata[0] = 50; ydata[0] = 150; xdata[1] = 200; ydata[1] = 50; xdata[2] = 350; ydata[2] = 150; int rgb = Color.HSBtoRGB(1.0f, 1.0f, 1.0f); g.setColor(new Color(rgb)); g.fillPolygon(xdata, ydata, n); } public static void main(String[] args) { JFrame frame = new JFrame(); frame.getContentPane().add(new MainClass()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(200, 200); frame.setVisible(true); } }