/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package javaapplication1; import javax.swing.*; import java.awt.*; import java.awt.event.*; /** * * @author Сергей */ public class JavaApplication1 extends JFrame implements Runnable{ public MyCanvas canvas; public DisplayMode dm; JavaApplication1(String title){ super(title); pack(); dm=getGraphicsConfiguration().getDevice().getDisplayMode(); setSize(dm.getWidth(),dm.getHeight()); setVisible(true); canvas=new MyCanvas(dm); canvas.setSize(dm.getWidth(),dm.getHeight()); add(canvas); } public void run(){ for(int i=0;i<50;i++){ try{Thread.sleep(80);}catch(Exception e){} canvas.invalidate(); } } public static void main(String[] args) { JavaApplication1 ja=new JavaApplication1("Канва"); new Thread(ja).start(); } }