Berikut ini kita akan membuat form login sederhana dengan menggunakan platform J2SE, gak asing mungkin untuk sebagian orang, hehe...
Form Login |
import java.awt.Container; import java.awt.FlowLayout; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; /** * 04 oct 2010 12:02 * @author dyah */ public class LoginFrame extends JFrame{ JLabel label1; JLabel label2; JTextField txtUser; JPasswordField txtPass; JButton cbLogin; JPanel panel1; JPanel panel2; Container c; public LoginFrame() { c = getContentPane(); label1 = new JLabel("Username: "); txtUser = new JTextField(20); label2 = new JLabel("Password: "); txtPass = new JPasswordField(20); cbLogin = new JButton("Login"); panel1 = new JPanel(); panel1.setLayout(new FlowLayout(FlowLayout.LEFT)); panel1.add(label1); panel1.add(txtUser); panel2 = new JPanel(); panel2.setLayout(new FlowLayout(FlowLayout.LEFT)); panel2.add(label2); panel2.add(txtPass); c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS)); c.add(panel1); c.add(panel2); c.add(cbLogin); setTitle("Project"); setSize(550, 500); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); } public static void main(String[] args) { Login n = new Login(); n.setVisible(true); } } |
kita juga punya nih artikel mengenai J2SE, berikut linknya semoga bermanfaat ya :D
BalasHapushttp://repository.gunadarma.ac.id/bitstream/123456789/2938/1/Artikel_10105421.pdf