📄 fldemo.java
字号:
// FLDemo.java
import java.awt.*;
class FLDemo extends Frame
{
final static int NOGAPS = 0;
final static int GAPS = 1;
FLDemo (String title, int gapsOption, int alignOption)
{
super (title);
if (gapsOption == GAPS)
setLayout (new FlowLayout (alignOption));
else
setLayout (new FlowLayout (alignOption, 0, 0));
for (int i = 0; i < 10; i++)
add (new Button ("Button " + i));
setSize (250, 250);
setVisible (true);
}
public static void main (String [] args)
{
int option1 = NOGAPS;
int option2 = FlowLayout.LEFT;
for (int i = 0; i < args.length; i++)
if (args [i].equalsIgnoreCase ("LEFT"))
option2 = FlowLayout.LEFT;
else
if (args [i].equalsIgnoreCase ("RIGHT"))
option2 = FlowLayout.RIGHT;
else
if (args [i].equalsIgnoreCase ("CENTER"))
option2 = FlowLayout.CENTER;
else
if (args [i].equalsIgnoreCase ("GAPS"))
option1 = GAPS;
else
if (args [i].equalsIgnoreCase ("NOGAPS"))
option1 = NOGAPS;
new FLDemo ("FlowLayout Demo", option1, option2);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -