Home > Back-end >  Why use paint method after the window is black
Why use paint method after the window is black

Time:10-29

Why use paint method after the window is darkened
Package cn. Wyq. Game;

The import javax.mail. Swing. *;
Import the Java. The awt. *;
Import the Java. The awt. Event. WindowAdapter;
Import the Java. The awt. Event. WindowEvent;

Public class MyGameFrame extends JFrame {@ Override public void paint (Graphics g) {g.d rawRect (100200100200); }
/* initialization window*/public void launchFrame () {enclosing setTitle (" meter division yong-qiang wei works "); Enclosing setVisible (true); Enclosing setSize (500500); Enclosing setLocation (300300); Enclosing addWindowListener (new WindowAdapter () {@ Override public void windowClosing (WindowEvent e) {System. Exit (0); }}); } public static void main (String [] args) {MyGameFrame f=new MyGameFrame (); F.l aunchFrame (); }
}
  • Related