import javax.swing.JFrame; import java.awt.Canvas; import java.awt.Graphics; import java.awt.Color; import java.awt.Polygon; class Program01 extends JFrame { RajzVaszon rajzVaszon = new RajzVaszon(); Program01() { add(rajzVaszon); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(800, 600); setVisible(true); } public static void main(String[] args) { new Program01(); } } class RajzVaszon extends Canvas { public void paint(Graphics g) { g.setColor(Color.red); Polygon poly = new Polygon(); poly.addPoint(200, 200); poly.addPoint(250, 250); poly.addPoint(250, 300); g.fillPolygon(poly); } }