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

📄 secondwindow.java

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

import java.awt.Color;
import java.awt.Container;

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

import swing.WindowDestroyer;




public class SecondWindow extends JFrame
{

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

    public SecondWindow( )
    {
        super( );

        setSize(WIDTH, HEIGHT);

        Container contentPane = getContentPane( );
        JLabel label = new JLabel("Now available in color!");
        contentPane.add(label);

        setTitle("Second Window");
        contentPane.setBackground(Color.BLUE);

        addWindowListener(new WindowDestroyer( ));
   }

    public SecondWindow(Color customColor)
    {
        super( );

        setSize(WIDTH, HEIGHT);

        Container contentPane = getContentPane( );
        JLabel label = new JLabel("Now available in color!");
        contentPane.add(label);

        setTitle("Second Window");
        contentPane.setBackground(customColor);

        addWindowListener(new WindowDestroyer( ));
   }
}





⌨️ 快捷键说明

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