Hello, I wonder why my oval doesn't show up on the frame.
Class with the oval
import java.awt.Color; import java.awt.Graphics; import javax.swing.JPanel; public class character extends JPanel { public character () { this.setBackground(Color.cyan); } @Override public void paintComponent(Graphics g) { super.paintComponents(g); g.setColor(Color.red); g.fillOval(67, 150, 100, 100); } }
Class supposed to show oval
import java.awt.Color; import javax.swing.JFrame; import javax.swing.JPanel; public class spelplan extends JPanel { character player1; public spelplan() { player1 = new character(); this.setBackground(Color.white); add(player1); } public static void main(String[] args) { JFrame f = new JFrame(); f.setSize(500,500); f.setLocation(200,200); f.setTitle("RogueTest"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); spelplan p = new spelplan(); f.add(p); f.setVisible(true); } }//class
I'm sure there is a simple solution but I can't see whats wrong. I even checked in my java-book and I can't find it out O.o