I\'m trying to create a program that draws shapes (a rectangle on the example below) using JPanel\'s paintComponent(), but I can\'t get it to work and can\'t spot what is wr
you're never actually adding the panel to the frame, so it is never visible. you need something like
frame.getContentPane().add( panel );
why are you defining the drawpanel class inside the main method? that's rather odd.