flowlayoutdemo.java

来自「JAVA程序设计课程中各章节的程序实例。」· Java 代码 · 共 29 行

JAVA
29
字号
/**
*A simple flow layout program
*2004.11.22. xhcprince
*/
import java.awt.*;

class A extends Frame
{
	A(String s)
	{
		super(s);
		setSize(300,160);
		setLayout(new FlowLayout());

		for(int i=1; i<=9; ++i)
		{
			add(new Button("Button " + i));
		}
		setVisible(true);//The buttons are from left to right,they're not folded together!
	}		         //But it's better to see the actul result!
}

class flowlayoutDemo
{
	public static void main(String args[])
	{
		A a = new A("Flow layout demostration");
	}
}//I still have to use the Ctrl+C to explicitly end the program:(

⌨️ 快捷键说明

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