package Test; import java.awt.*; import javax.swing.*; public class Example extends JFrame{ public void CreatJFrame(String title) { JFrame jf = new JFrame(title); Container container = jf.getContentPane(); JLabel jl = new JLabel("Hello"); jl.setHorizontalAlignment(SwingConstants.CENTER); container.add(jl); container.setBackground(new Color(117,114,116)); jf.setVisible(true); jf.setSize(100,200); jf.setDefaultCloseOperation(Example.EXIT_ON_CLOSE); } public static void main(String[] args) { // TODO Auto-generated method stub new Example().CreatJFrame("BiuBiuBiu"); } }
嗯