Jumat, 18 Mei 2012

Membuat Label

Input:

import javax.swing.JLabel;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.*;

class Label
{public static void main (String[]args)
{JLabel lbl=new JLabel("MASUKAN DATA ANDA :");
JLabel lbl1=new JLabel("Nama Anda :");
JLabel lbl2=new JLabel("NPM Anda :");
JLabel lbl3=new JLabel("Jurusan Anda :");
JLabel lbl4=new JLabel("Alamat Anda :");

JFrame frame=new JFrame();

JTextField txt1=new JTextField();
JTextField txt2=new JTextField();
JTextField txt3=new JTextField();
JTextField txt4=new JTextField();
JButton bttn= new JButton("Done");

lbl.setBounds(160,50,150,25);
lbl1.setBounds(100,120,90,25);
txt1.setBounds (190,120,150,25);
bttn.setBounds(190,250,80,25);

lbl2.setBounds(100,140,100,25);
txt2.setBounds (190,140,150,25);

lbl3.setBounds(100,160,110,25);
txt3.setBounds (190,160,150,25);

lbl4.setBounds(100,180,120,25);
txt4.setBounds (190,180,150,50);

frame.add(lbl);
frame.add(lbl1);
frame.add(txt1);
frame.add(txt2);
frame.add(txt3);
frame.add(txt4);
frame.add(bttn);

frame.add(lbl2);
frame.add(txt2);
frame.add(lbl3);
frame.add(lbl4);

frame.setSize(500,500);
frame.setLayout(null);
frame.setVisible(true);
}
}



Output:


Tidak ada komentar:

Posting Komentar