/* * 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); FlowLayout fl=new FlowLayout(); fl.setAlignment(FlowLayout.CENTER); setLayout(fl); canvas=new MyCanvas(dm); canvas.setSize(dm.getWidth(),dm.getHeight()); add(canvas); } public void run(){ for(int i=0;i<100;i++){ try{Thread.sleep(100);}catch(Exception e){} canvas.repaint(); } } public static void main(String[] args) { JavaApplication1 ja=new JavaApplication1("Канва"); new Thread(ja).start(); } }