secondwindow.java
来自「此文件能系统的介绍Java初级知识」· Java 代码 · 共 57 行
JAVA
57 行
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 + =
减小字号Ctrl + -
显示快捷键?