Posts

Showing posts from January 25, 2019

Java swing Paint method not being called

Image
0 I've setup this really bare-bones View class to test out the Paint method from java swing. However, I noticed that even though I create an instance of view from another class and keep calling the update method below, the paint method is never executed. EDIT: I added code from main and controller. import java.awt.*; import java.awt.Color; import java.awt.Graphics; import javax.swing.JFrame; import javax.swing.JPanel; public class View extends JPanel { //Attributes private static int frameWidth = 500; private static int frameHeight = 500; private JFrame frame; // the frame private JPanel menu; private JPanel game; private JPanel summary; //Constructor public View(ControlListener controlListener) { this.frame = new JFrame(); frame.setLayo