Advertisement
Guest User

java

a guest
Oct 2nd, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.71 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package tugas_masjion;
  7. import java.awt.*;  
  8. import javax.swing.*;  
  9.  
  10. /**
  11.  *
  12.  * @author ulul
  13.  */
  14.  
  15. public class frame extends JFrame{
  16.     Button btn1 = new Button("Masuk");
  17.     TextField txtField = new TextField();
  18.     JPasswordField passwordField = new JPasswordField();
  19.     Label lbl_username = new Label("Username");
  20.     Label lbl_password = new Label("Password");
  21.     Label label_login = new Label("Sign In To Start Your Session");
  22.     public frame() {
  23.         // ini method constructor
  24.         super("Sign In To APP");
  25.        // setLocation(500,200);
  26.         setSize(300,300);
  27.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  28.     }
  29.     public void komponen(){
  30.         setResizable(false);
  31.         getContentPane().setLayout(null);
  32.         getContentPane().setBackground(Color.PINK);
  33.         getContentPane().add(btn1);
  34.         getContentPane().add(txtField);
  35.         getContentPane().add(passwordField);
  36.         getContentPane().add(lbl_username);
  37.         getContentPane().add(lbl_password);
  38.         getContentPane().add(label_login);
  39.        
  40.         label_login.setBounds(50,20,200,20);
  41.         btn1.setBounds(10, 180, 100, 20);
  42.         btn1.setBackground(Color.blue);
  43.         txtField.setBounds(90,70,100,20);
  44.          
  45.         passwordField.setBounds(90,100,100,20);
  46.         lbl_username.setBounds(10,70,90,20);
  47.         lbl_password.setBounds(10,100,90,20);
  48.         setVisible(true);
  49.     }
  50.     public static void main(String[] args) {
  51.         frame obj = new frame();
  52.         obj.komponen();
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement