import javax.swing.*; import java.awt.*; class Program extends JFrame { Program() { getContentPane().add(new SajatKomponens()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(800, 600); setVisible(true); } public static void main(String args[]) { new Program(); } public class SajatKomponens extends JComponent { public void paint(Graphics g) { g.setColor(Color.blue); g.drawRect(10, 10, 50, 50); } } }