Taller 4

168 views

Published on

Published in: Health & Medicine
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
168
On SlideShare
0
From Embeds
0
Number of Embeds
19
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Taller 4

  1. 1. importjava.awt.*;importjavax.swing.*;public class w extends JFrame{publicVentanaBorderLayout() {super("Agregatitulo");Container COn=getContentPane();JButton b1=new JButton("A");JButton b2=new JButton("B");JButton b3=new JButton("C");JButton b4=new JButton("D");JButton b5=new JButton("E");COn.setLayout(new BorderLayout());COn.add(b1,BorderLayout.NORTH);//arribaCOn.add(b2,BorderLayout.SOUTH);//abajoCOn.add(b3,BorderLayout.WEST);//izquierdaCOn.add(b4,BorderLayout.EAST);//derechoCOn.add(b5,BorderLayout.CENTER);//centrosetDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);}public static void main (String[] args) {VentanaBorderLayout v=new VentanaBorderLayout();v.setSize(300,300);v.setVisible(true);}
  2. 2. }importjava.awt.*;importjavax.swing.*;public class VentanaFlowLayout extends JFrame{publicVentanaFlowLayout() {super("Agregatitulo");Container COn=getContentPane();JButton b1=new JButton("A");JButton b2=new JButton("B");JButton b3=new JButton("BOTON MAS LARGO");JButton b4=new JButton("D");JButton b5=new JButton("E");COn.setLayout(new FlowLayout());COn.add(b1);COn.add(b2);COn.add(b3);COn.add(b4);COn.add(b5);}public static void main (String[] args) {VentanaFlowLayout vent=new VentanaFlowLayout();vent.setSize(200,200);vent.setVisible(true);vent.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  3. 3. }}public class VentanaGridLayout extends JFrame{public VentanaGridLayout() {super("4.3. GridLayout");Container Leo=getContentPane();JButton b1=new JButton("BOTON 1");JButton b2=new JButton("BOTON 2");JButton b3=new JButton("BOTON 3");JButton b4=new JButton("BOTON 4");JButton b5=new JButton("BOTON 5");Leo.setLayout(new GridLayout(3,3));Leo.add(b1);Leo.add(b2);Leo.add(b3);Leo.add(b4);Leo.add(b5);setSize(300,300);setVisible(true);setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);}public static void main (String[] args) {newVentanaGridLayout();}}

×