/* * 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 java.awt.*; /** * * @author Сергей */ public class MyCanvas extends Canvas{ private DisplayMode dm; private int y; public MyCanvas(DisplayMode dm){ this.dm=dm; y=0; this.setBackground(Color.BLACK); } public void paint(Graphics g){ update(g); } public void update(Graphics g){ g.setColor(Color.black); g.fillRect(0,0,this.getWidth(),this.getHeight()); g.setColor(Color.WHITE); g.drawLine(0, y,this.getWidth(), y); g.drawString("Ширина дисплей="+dm.getWidth()+",высота дисплей="+dm.getHeight()+",y="+y,dm.getWidth()/2 ,10); y+=4; } }