zoukankan      html  css  js  c++  java
  • 使用java语言编写窗口按钮

    使用java语言编写窗口按钮

    代码如下:

    package Day08; import java.awt.FlowLayout; import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTextField; public class ShowFlowLayout extends JFrame {
    public ShowFlowLayout() {
    //Set FlowLayout, hgap = 10, vgap = 20, alignment = LEFT
    FlowLayout myFlowLayout = new FlowLayout(FlowLayout.LEFT, 10, 20);
    setLayout(myFlowLayout);

    add(new JLabel("姓名1"));
    add(new JTextField(8));
    add(new JLabel("姓名2"));
    add(new JTextField(8));
    add(new JLabel("姓名3"));
    add(new JTextField(8));
    }

    public static void main(String[] args) {
    ShowFlowLayout frame = new ShowFlowLayout();

    frame.setSize(350, 200);//set the frame size
    frame.setLocationRelativeTo(null);// center a frame
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);// center a frame
    frame.setVisible(true);//display the frame
    }
    }

    只相信苦尽甘来
  • 相关阅读:
    Counting Stars hdu
    Color it hdu
    steins;Gate
    原根
    3-idiots
    Tree
    洛谷P1352 没有上司的舞会
    洛谷P1131 时态同步
    洛谷P3177 树上染色
    Codeforces Round #617 (Div. 3)
  • 原文地址:https://www.cnblogs.com/F001li/p/7055942.html
Copyright © 2011-2022 走看看