Advertisement
Syafaldi

[PBO] Pertemuan ke 4

Feb 25th, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.20 KB | None | 0 0
  1. import java.awt.*;
  2. import javax.swing.*;
  3.  
  4. public class swing extends JFrame{
  5.     JButton signup,login;
  6.     Label text,textusername,textpassword;
  7.     JTextField username;
  8.     JPasswordField password;
  9.    
  10.     public void cobaSwing(){
  11.         setTitle("cobaTitle");
  12.         signup = new JButton("Sign Up");
  13.         login = new JButton("Login");
  14.         text = new Label("Login");
  15.         textusername = new Label("Username");
  16.         textpassword = new Label("Password");
  17.         username = new JTextField();
  18.         password = new JPasswordField();
  19.        
  20.         setLayout(null);
  21.         add(signup);
  22.         add(login);
  23.         add(text);
  24.         add(textusername);
  25.         add(textpassword);
  26.         add(username);
  27.         add (password);
  28.        
  29.         textusername.setBounds (50,50,100,30);
  30.         username.setBounds (160,55,100,20);
  31.         textpassword.setBounds (50,90,100,30);
  32.         password.setBounds (160,95,100,20);
  33.         text.setBounds (130,10,80,30);
  34.         signup.setBounds(50,150,80,30);
  35.         login.setBounds(180,150,80,30);
  36.        
  37.         pack();
  38.         setSize(325,250);
  39.         setVisible(true);
  40.         setDefaultCloseOperation(EXIT_ON_CLOSE);
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement