⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 j_frame.java.bak

📁 一个十分好的java基础学习的课件
💻 BAK
字号:
// ////////////////////////////////////////////////////////
// 
// J_Frame.java
// 
// Created by Jun-Hai Yong,    on XX xx, xxxx (Date)
// ////////////////////////////////////////////////////////
// Readme:
//      Example of JFrame and JPanel.
// ////////////////////////////////////////////////////////
// Using this example, please explicitly refer to the book:
//     Jun-Hai Yong. Programming in Java. 
//     Beijing: Tsinghua University Press, 2004.
// 使用本例子,请注明引用:
//     雍俊海. Java 程序设计. 北京: 清华大学出版社, 2004.
// Please note that the author and publisher make no 
// warranty of any kind on the examples provided.
// ////////////////////////////////////////////////////////

import java.awt.*;
import javax.swing.*;

public class J_Frame
{
    public static void main( String args[] )
    { 
        JFrame app = new JFrame("Example of JFrame and JPanel");
        app.setSize( 100, 100 );
        app.setVisible( true );
        app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );

        JPanel p= new JPanel( );
        p.setSize( 80, 80 );
        p.setBackground(Color.green);

        JPanel p0= new JPanel( );
        p0.setSize( 40, 40 );
        p0.setBackground(Color.yellow);
        p.add(p0);

        Container container = app.getContentPane( );
        container.setLayout( null );
        container.add(p);
    } // End of method: main

} // End of class: J_Frame

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -