import javax.swing.*; import java.awt.*; public class HoldLabels extends JPanel { JLabel l1, l2, l3; Font headlineFont = new Font("Arial", Font.BOLD, 24); public HoldLabels() { setLayout(new FlowLayout(FlowLayout.CENTER)); setBackground(Color.BLACK); setBorder(BorderFactory.createLineBorder(Color.WHITE,5)); setOpaque(true); setSize(500, 75); setLocation(50, 50); setVisible(true); l1 = new JLabel("United States Crazy Laws", JLabel.CENTER); l1.setBackground(Color.BLACK); l1.setFont(headlineFont); l1.setPreferredSize(new Dimension(350, 50)); l1.setForeground(Color.WHITE); l1.setOpaque(true); add(l1); } }