Java tutorial
//package com.java2s; import javax.swing.*; import javax.swing.border.LineBorder; import java.awt.*; public class Main { public static final Dimension SCREEN_SIZE = Toolkit.getDefaultToolkit().getScreenSize(); public static void addNewLineTo(Container container) { JLabel label = new JLabel(); label.setPreferredSize(new Dimension(SCREEN_SIZE.width, 0)); container.add(label); } public static void addNewLineTo(Container container, int lineHeight) { JLabel label = new JLabel(); label.setPreferredSize(new Dimension(SCREEN_SIZE.width, lineHeight)); label.setBorder(new LineBorder(Color.BLACK)); container.add(label); } }