multicomponentsdemo2_gui.java
来自「JAVA程序设计课程中各章节的程序实例。」· Java 代码 · 共 30 行
JAVA
30 行
/**
*A simple multi components program using layout in GUI
*2004.11.27. xhcprince
*Pay attention to the difference to the previous multicomponentsDemo_GUI.java !
*/
import java.awt.*;
public class multicomponentsDemo2_GUI extends Frame
{
public multicomponentsDemo2_GUI()
{
add(new Label("First name"));
add(new TextField(10));
add(new Label("Second name"));
add(new TextField(10));
add(new Label("Password"));
add(new TextField(10));
add(new Button("Save"));
}
public static void main(String args[])
{
multicomponentsDemo2_GUI M2 = new multicomponentsDemo2_GUI();
M2.setLayout(new FlowLayout());
M2.setVisible(true);
M2.setSize(400,300);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?