SELAMAT DATANG
DI WILAYAH TERITORIAL
KEKUASAAN SAYA
^_^

Kamis, 10 Januari 2013

TUGAS MANAJEMEN LAYOUT

import java.awt.*; import javax.swing.*; class layout extends JFrame { JButton Button0,Button1, Button2, Button3, Button4,Button5, Button6, Button7, Button8, Button9, Button10, Button11 ; JLabel lNama,lNama2,lNama3; JPanel P1,P2,P3; public layout() { setTitle("Aryanti"); JLabel lNama= new JLabel("Flow Layout" ); JButton Button0=new JButton ("0"); JButton Button1=new JButton ("1"); JButton Button2=new JButton ("2"); JButton Button3=new JButton ("3"); JLabel lNama2= new JLabel("None Layout" ); JButton Button4=new JButton ("4"); JButton Button5=new JButton ("5"); JButton Button6=new JButton ("6"); JButton Button7=new JButton ("7"); JLabel lNama3= new JLabel("Grid Layout" ); JButton Button8=new JButton ("8"); JButton Button9=new JButton ("9"); JButton Button10=new JButton ("10"); JButton Button11=new JButton ("11"); P1 = new JPanel(); P2 = new JPanel(); P3 = new JPanel(); setLayout(null); add(lNama); add(lNama2); add(lNama3); add(P1); add(P2); add(P3); lNama.setBounds(15,10,100,20); lNama2.setBounds(220,10,100,20); lNama3.setBounds(320,10,100,20); P1.setBounds(5,30,200,40); P2.setBounds(215,30,200,100); P3.setBounds(320,30,200,150); P1.setLayout(new FlowLayout()); P1.add(Button0); P1.add(Button1); P1.add(Button2); P1.add(Button3); P2.setLayout(null); P2.add(Button4); P2.add(Button5); P2.add(Button6); P2.add(Button7); Button4.setBounds(10,10,65,25); Button5.setBounds(10,35,65,25); Button6.setBounds(10,55,65,25); Button7.setBounds(10,75,65,25); P3.setLayout(new GridLayout(2,1)); P3.add(Button8); P3.add(Button9); P3.add(Button10); P3.add(Button11); P3.setSize(100,100); (500,200); setVisible(true); setDefaultCloseOperation(3); } } public class aryanti{ public static void main(String[] args) { layout l = new layout(); } }

Tidak ada komentar:

Posting Komentar

Ada kesalahan di dalam gadget ini