/* * 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.*; import javax.swing.*; /** * * @author Сергей */ public class MyCanvas extends JPanel{ private DisplayMode dm; private int y; public MyCanvas(DisplayMode dm){ this.dm=dm; y=0; this.setLayout(null); } public void paintComponent(Graphics g){ super.paintComponent(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++; } }