import javax.swing.*;
public class Form extends JFrame {
JTextField username = new JTextField(15);
JPasswordField password = new JPasswordField(15);
JTextArea comments = new JTextArea(4,15);
JButton oke = new JButton("Oke");
JButton cancel = new JButton("Cancel");
public Form() {
super("Feedback Form");
setSize(260,160);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel pane = new JPanel();
JLabel usernameLabel = new JLabel("Username : ");
JLabel passwordLabel = new JLabel("Password : ");
JLabel commentsLabel = new JLabel("Comments : ");
comments.setLineWrap(true);
comments.setWrapStyleWord(true);
//password.setEchoChar('#');
JScrollPane scroll = new JScrollPane(comments,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
pane.add(usernameLabel);
pane.add(username);
pane.add(passwordLabel);
pane.add(password);
pane.add(commentsLabel);
pane.add(comments);
pane.add(oke);
pane.add(cancel);
pane.add(scroll);
setContentPane(pane);
show();
}
public static void main(String[] args) {
Form input = new Form();
}
}
0 komentar:
Posting Komentar