java - Paint in Swing not working -


why not work? shows me gui not paint. how change 2 classes?

import java.awt.graphics; import javax.swing.jframe;  public class runpaintgui extends jframe{          public static void main(string[] args){         jframe frame = new jframe();         frame.setsize(5000,2000);         frame.setresizable(false);         frame.settitle("game");         frame.setvisible(true);         }      public void paint(graphics g){         super.paint(g);         g.drawstring("adsf",40,45);         g.draw3drect(50, 30, 600, 700, true);             repaint();     }     } 

you creating generic jframe in line:

jframe frame = new jframe(); 

what want is:

jframe frame = new runpaintgui(); 

then paint() method will called.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -