本帖最后由 zl918 于 2012-1-9 12:47 编辑
- import java.awt.*;
- import javax.swing.*;
- import java.io.*;
- public class MyFrame {
- public static void main(String[] args)
- {
- JFrame frame=new JFrame("MyFrame"); //窗口框架
- frame.setSize(800,300);
- frame.getContentPane().setBackground(Color.RED); //背景
- frame.setVisible(true); //窗口可见
-
- JPanel contentPane=new JPanel(); //添加JPanel
- contentPane.setSize(100,100);
- contentPane.setBackground(Color.yellow);
- frame.add(contentPane);
-
-
- BufferedReader intemp=new BufferedReader(new InputStreamReader(System.in));
- System.out.println("Press return key to exit!");
- try
- {
- String s=intemp.readLine();
- }catch(IOException e)
- {
- System.out.println("IOException");
- }
- System.exit(0);
- }
- }
复制代码 |