201243500119 FERRY TARYONO Y6R


import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

 

public class tugas1a {

public static void main (String[]args) {

JFrame jframe = new JFrame (“Data Mahasiswa”);

 

JButton tombol1 = new JButton (“Simpan”);

 

JLabel lbl = new JLabel (“DATA MAHASISWA”);

JLabel lbl1 = new JLabel (“NPM”);

JLabel lbl2 = new JLabel (“Nama”);

JLabel lbl3 = new JLabel (“Prodi”);

JLabel lbl4 = new JLabel (“Alamat”);

JLabel lbl5 = new JLabel (“No. Telepon”);

JLabel lbl6 = new JLabel (“-“);

 

JTextField npm = new JTextField(12);

JTextField nama = new JTextField(30);

JTextField prd = new JTextField(20);

JTextField almt = new JTextField(50);

JTextField tel = new JTextField(4);

JTextField tel1 = new JTextField(10);

 

tombol1.setBounds (250,270,100,25);

 

lbl.setBounds(240,30,150,15);

lbl1.setBounds(30,80,150,25);

lbl2.setBounds(30,110,150,25);

lbl3.setBounds(30,140,150,25);

lbl4.setBounds(30,170,150,25);

lbl5.setBounds(30,200,150,25);

lbl6.setBounds(175,200,30,25);

npm.setBounds(120,80,100,25);

nama.setBounds(120,110,200,25);

prd.setBounds(120,140,150,25);

almt.setBounds(120,170,350,25);

tel.setBounds(120,200,50,25);

tel1.setBounds(185,200,120,25);

 

jframe.setLocation(80,100);

jframe.setSize(600,400);

jframe.setVisible(true);

jframe.getContentPane().setLayout(null);

 

jframe.getContentPane().add(tombol1);

 

jframe.getContentPane().add(lbl);

jframe.getContentPane().add(lbl1);

jframe.getContentPane().add(lbl2);

jframe.getContentPane().add(lbl3);

jframe.getContentPane().add(lbl4);

jframe.getContentPane().add(lbl5);

jframe.getContentPane().add(lbl6);

 

jframe.getContentPane().add(npm);

jframe.getContentPane().add(nama);

jframe.getContentPane().add(prd);

jframe.getContentPane().add(almt);

jframe.getContentPane().add(tel);

jframe.getContentPane().add(tel1);

 

jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

}

 

HASIL OUT PUT

Tugas 1a

 

_____________________________________________________________________________

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

 

public class tugas1b {

public static void main (String[]args) {

 

JFrame jframe = new JFrame (“Data Mahasiswa”);

 

JButton tombol1 = new JButton (“Simpan”);

JButton tombol2 = new JButton (“Batal”);

 

JLabel lbl = new JLabel (“DATA MAHASISWA”);

JLabel lbl1 = new JLabel (“Nama”);

JLabel lbl2 = new JLabel (“NPM”);

JLabel lbl3 = new JLabel (“Kelas”);

JLabel lbl4 = new JLabel (“Mata Kuliah”);

JLabel lbl5 = new JLabel (“Dosen”);

JLabel lbl6 = new JLabel (“Program Studi”);

JLabel lbl7 = new JLabel (“Universitas”);

 

JTextField nama = new JTextField(30);

JTextField npm = new JTextField(12);

JTextField kls = new JTextField(5);

JTextField mk = new JTextField(45);

JTextField dsn = new JTextField(35);

JTextField ps = new JTextField(35);

JTextField unv = new JTextField(35);

 

tombol1.setBounds (150,325,100,25);

tombol2.setBounds (350,325,100,25);

 

lbl.setBounds(240,30,150,15);

lbl1.setBounds(30,80,150,25);

lbl2.setBounds(30,110,150,25);

lbl3.setBounds(30,140,150,25);

lbl4.setBounds(30,170,150,25);

lbl5.setBounds(30,200,150,25);

lbl6.setBounds(30,230,150,25);

lbl7.setBounds(30,260,150,25);

 

nama.setBounds(150,80,200,25);

npm.setBounds(150,110,100,25);

kls.setBounds(150,140,50,25);

mk.setBounds(150,170,250,25);

dsn.setBounds(150,200,250,25);

ps.setBounds(150,230,150,25);

unv.setBounds(150,260,180,25);

jframe.setLocation(80,100);

jframe.setSize(600,450);

jframe.setVisible(true);

jframe.getContentPane().setLayout(null);

 

jframe.getContentPane().add(tombol1);

jframe.getContentPane().add(tombol2);

 

jframe.getContentPane().add(lbl);

jframe.getContentPane().add(lbl1);

jframe.getContentPane().add(lbl2);

jframe.getContentPane().add(lbl3);

jframe.getContentPane().add(lbl4);

jframe.getContentPane().add(lbl5);

jframe.getContentPane().add(lbl6);

jframe.getContentPane().add(lbl7);

 

jframe.getContentPane().add(nama);

jframe.getContentPane().add(npm);

jframe.getContentPane().add(kls);

jframe.getContentPane().add(mk);

jframe.getContentPane().add(dsn);

jframe.getContentPane().add(ps);

jframe.getContentPane().add(unv);

 

jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

}

HASIL OUT PUT

Tugas 1b

 

_____________________________________________________________________________

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

 

public class tugas2 {

public static void main (String[]args) {

 

JFrame jframe = new JFrame (“Data Mahasiswa”);

 

JButton tombol1 = new JButton (“Simpan”);

JButton tombol2 = new JButton (“Edit”);

JButton tombol3 = new JButton (“Hapus”);

JButton tombol4 = new JButton (“Keluar”);

 

String[]abc ={“Islam”,”Kristen”,”Katolik”,”Budha”,”Hindu”,”Khonghuchu”};

JComboBox cb = new JComboBox(abc);

 

JRadioButton r1 = new JRadioButton(“Laki-laki”);

JRadioButton r2 = new JRadioButton(“Perempuan”);

 

JCheckBox c1 = new JCheckBox(“Membaca”);

JCheckBox c2 = new JCheckBox(“Olahraga”);

JCheckBox c3 = new JCheckBox(“Menyanyi”);

JCheckBox c4 = new JCheckBox(“Menari”);

JCheckBox c5 = new JCheckBox(“Memasak”);

JCheckBox c6 = new JCheckBox(“Menulis”);

 

JLabel lbl = new JLabel (“DATA MAHASISWA”);

JLabel lbl1 = new JLabel (“NPM”);

JLabel lbl2 = new JLabel (“Nama”);

JLabel lbl3 = new JLabel (“Agama”);

JLabel lbl4 = new JLabel (“Jenis Kelamin”);

JLabel lbl5 = new JLabel (“Hobi”);

 

JTextField npm = new JTextField(12);

JTextField nama = new JTextField(30);

 

lbl.setBounds(240,30,150,15);

lbl1.setBounds(30,80,150,25);

lbl2.setBounds(30,110,150,25);

lbl3.setBounds(30,140,150,25);

lbl4.setBounds(30,170,150,25);

lbl5.setBounds(30,200,150,25);

npm.setBounds(150,80,120,25);

nama.setBounds(150,110,200,25);

 

cb.setBounds(150,140,100,25);

r1.setBounds(150,170,100,25);

r2.setBounds(250,170,100,25);

c1.setBounds(150,200,100,25);

c2.setBounds(150,230,100,25);

c3.setBounds(150,260,100,25);

c4.setBounds(250,200,100,25);

c5.setBounds(250,230,100,25);

c6.setBounds(250,260,100,25);

 

tombol1.setBounds (60,320,100,25);

tombol2.setBounds (180,320,100,25);

tombol3.setBounds (300,320,100,25);

tombol4.setBounds (420,320,100,25);

 

jframe.setLocation(80,100);

jframe.setSize(600,430);

jframe.setVisible(true);

jframe.getContentPane().setLayout(null);

 

jframe.getContentPane().add(npm);

jframe.getContentPane().add(nama);

jframe.getContentPane().add(lbl);

jframe.getContentPane().add(lbl1);

jframe.getContentPane().add(lbl2);

jframe.getContentPane().add(lbl3);

jframe.getContentPane().add(lbl4);

jframe.getContentPane().add(lbl5);

 

jframe.getContentPane().add(cb);

jframe.getContentPane().add(r1);

jframe.getContentPane().add(r2);

jframe.getContentPane().add(c1);

jframe.getContentPane().add(c2);

jframe.getContentPane().add(c3);

jframe.getContentPane().add(c4);

jframe.getContentPane().add(c5);

jframe.getContentPane().add(c6);

jframe.getContentPane().add(tombol1);

jframe.getContentPane().add(tombol2);

jframe.getContentPane().add(tombol3);

jframe.getContentPane().add(tombol4);

jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

}

 

HASIL OUT PUT

Tugas 2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: