package pages; import javax.swing.*;import java.awt.*; public class page409 extends JFrame { public page409(){ setTitle("TextField Example"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container c = getContentPane(); c.setLayout(new FlowLayout()); c.add(new JLabel("Name ")); c.add(new JTextField(20)); c.add(new JLabel("Major ")); c.add(new JTextField("Computer Science",20)); c.add(new JLabel("Address ")); c.add(new JTextField("Earth",20)); setSize(300,150); setVisible(true); } public static void main(String[] args){ new page409(); } }
//label means small component for text
//textField means textArea to get an user input
댓글
댓글 쓰기