rendered paste bodyimport java.awt.Dimension;import java.awt.event.*;import java.awt.*;import javax.swing.JFrame;import javax.swing.UIManager;import javax.swing.JPanel;import javax.swing.*;public class Test implements ActionListener { public Component createComponents() { JPanel panel = new JPanel(new GridLayout(0,1)); //panel.setBackground(new Color(0.0f, 0.5f, 0.0f)); return panel; } public void actionPerformed(ActionEvent e) { } private static void initLookAndFeel() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); }catch(Exception e) { System.out.println("Look and feel failed: " + e); } } private static void createAndShowGUI() { initLookAndFeel(); Dimension dim = new Dimension(640,480); JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame("Hello!"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(dim); frame.setMinimumSize(dim); frame.setMaximumSize(dim); Test myTest = new Test(); Component contents = myTest.createComponents(); frame.getContentPane().add(contents,BorderLayout.CENTER); frame.setBackground(new Color(0.0f, 0.5f, 0.0f)); frame.pack(); frame.setVisible(true); } /** * @param args */ public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); }}