import javax.swing.*; import java.awt.*; public class MyLabel extends JLabel { // Completely new constructor method public MyLabel() { setPreferredSize(new Dimension(200,75)); setBackground(Color.ORANGE); setOpaque(true); setText("Hello Again"); setHorizontalAlignment(JLabel.CENTER); } public MyLabel(String a) { super(a, JLabel.CENTER); setPreferredSize(new Dimension(200, 80)); setBackground(Color.BLUE); setFont(new Font("Arial", Font.BOLD+Font.ITALIC, 16)); setText(a); setOpaque(true); setBorder(BorderFactory.createLineBorder(Color.YELLOW, 5)); setForeground(Color.GREEN); } }