import javax.swing.*; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Line2D; 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) { Graphics2D g2 = (Graphics2D) g; g2.setColor(Color.blue); Line2D lin = new Line2D.Float(100, 100, 250, 260); g2.draw(lin); } } }