import javax.swing.*; import java.awt.*; public class CustomPanel extends JPanel { private int width = 1920; private int height = 1080; public CustomPanel() { setBackground(Color.WHITE); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics g2 = g.create(); g2.setColor(Color.BLACK); for(int x=0; x<width; x=x+50){ g2.drawLine(x, 0, x, 1080); } for(int y=0; y<height; y=y+50){ g2.drawLine(0, y, 1920, y); } } }