GUI之绘制简单文本框

package day15;

 

import javax.swing.*;

import java.awt.*;

 

public class TextField extends JFrame {

    public TextField() {

        Container container = this.getContentPane();

 

        JTextField textField1 = new JTextField("xiao");

        JTextField textField2 = new JTextField("ming", 30);

 

        container.add(textField1, BorderLayout.NORTH);

        container.add(textField2, BorderLayout.SOUTH);

 

        this.setVisible(true);

        this.setSize(200, 200);

        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

 

    }

 

    public static void main(String[] args) {

        new TextField();

    }

}

执行结果:

GUI之绘制简单文本框

上一篇:Linq无聊练习系列6--Any/All/Contains/Concat/Union/Intersect/Except/take/skip/SqlMethods操作练习


下一篇:Photoshop打造江南特色的透明油纸伞