
Koding :
import javax.swing.*;
import java.awt.*;
class tesFrame extends JFrame
{
JLabel user, pass, welcome;
JTextField tuser;
JPasswordField tpass;
JButton b1, b2;
public static void main(String[] args){
tesFrame f = new tesFrame();
f.setSize(300, 170);
f.setTitle("Example Form");
f.setResizable(false);
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public tesFrame(){
welcome = new JLabel("WELCOME ADMINISTRATOR");
welcome.setFont(new Font("Georgia", Font.BOLD, 14));
user = new JLabel("Username : ", JLabel.RIGHT);
user.setFont(new Font("Tahoma", Font.BOLD, 11));
tuser = new JTextField();
tuser.setFont(new Font("Tahoma", Font.PLAIN, 11));
tpass = new JPasswordField();
tpass.setFont(new Font("Tahoma", Font.BOLD, 11));
tpass.setEchoChar('*');
welcome.setBounds(new Rectangle(35, 10, 250, 30));
user.setBounds(new Rectangle(0, 45, 100, 23));
tuser.setBounds(new Rectangle(105, 45, 160, 22));
this.getContentPane().setLayout(null);
this.getContentPane().add(welcome, null);
this.getContentPane().add(user, null);
this.getContentPane().add(tuser, null);
}
};
Ouput yang dihasilkanpun seperti gambar di atas.
Terima Kasih..
Semoga bermanfaat.. :-):-):-)
0 comments:
Post a Comment