Buat class Form.java Lalu simpan
import javax.swing.*;
public class Form extends JFrame {
JTextField username = new JTextField(20);
JPasswordField password = new JPasswordField(20);
JTextArea comments = new JTextArea(10,20);
public Form() {
super("Membuat Form");
setSize(300,200);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel pane = new JPanel();
JLabel usernameLabel = new JLabel("Nama : ");
JLabel passwordLabel = new JLabel("Password : ");
JLabel commentsLabel = new JLabel("Komentar : ");
comments.setLineWrap(true);
comments.setWrapStyleWord(true);
//password.setEchoChar('#');
JScrollPane scroll = new JScrollPane
(comments, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
public class Form extends JFrame {
JTextField username = new JTextField(20);
JPasswordField password = new JPasswordField(20);
JTextArea comments = new JTextArea(10,20);
public Form() {
super("Membuat Form");
setSize(300,200);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel pane = new JPanel();
JLabel usernameLabel = new JLabel("Nama : ");
JLabel passwordLabel = new JLabel("Password : ");
JLabel commentsLabel = new JLabel("Komentar : ");
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(scroll);
setContentPane(pane);
show();
}
public static void main(String[] args) {
Form input = new Form();
}
}
Output
Wahh hebatt mass.. Mahirr nih soal java.. heheh
BalasHapuswah keren mas!!!
BalasHapussemua tentang java ada disini neh!!!
mantapzzz mas
sukses trus yaaa
keren nih, tapi lebih efisien mana Mas antara form yang dibentuk dari HTML dengan form dari java???
BalasHapusmakasih atas jawabannya...
wehh...?
BalasHapussaya kagak paham dengan java, hehehe
Regi_Adi : sama2 keren ko sob, cuma kalu java lebih keren lagi menurut saya :)
BalasHapus