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

📄 borderlayoutdemo.java

📁 此文件能系统的介绍Java初级知识
💻 JAVA
字号:
package swing.layout.borderlayout;

import java.awt.BorderLayout;
import java.awt.Container;

import javax.swing.JFrame;
import javax.swing.JLabel;

import swing.WindowDestroyer;


/**
 Simple demonstration of using a layout manager
 to arrange labels.
*/
public class BorderLayoutDemo extends JFrame
{

	public static final int WIDTH = 300;
    public static final int HEIGHT = 200;

    /**
     Creates and displays a window of the class BorderLayoutDemo.
    */
    public static void main(String[] args)
    {
        BorderLayoutDemo gui = new BorderLayoutDemo( );
        gui.setVisible(true);
    }

    public BorderLayoutDemo( )
    {
        setSize(WIDTH, HEIGHT);
        addWindowListener(new WindowDestroyer( ));
        setTitle("Layout Demonstration");
        Container content = getContentPane( );

        content.setLayout(new BorderLayout( ));

        JLabel label1 = new JLabel("First label here.");
        content.add(label1, BorderLayout.NORTH);

        JLabel label2 = new JLabel("Second label there.");
        content.add(label2, BorderLayout.SOUTH);

        JLabel label3 = new JLabel("Third label anywhere.");
        content.add(label3, BorderLayout.CENTER);
    }
}





⌨️ 快捷键说明

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