Advertisement
fabioceep

JAVA: Layout de Fluxo (PG 290)

Feb 22nd, 2020
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.24 KB | None | 0 0
  1. package gerenciadoreslayout;
  2. import javax.swing.*;
  3. import java.awt.*;
  4.  
  5. public class GerenciadoresLayout {
  6.     public static void main(String[] args) {
  7.         GerenciadoresLayout sistema = new GerenciadoresLayout();
  8.         sistema.iniciar();
  9.     }
  10.     public void iniciar() {
  11.         JFrame janela = new JFrame();
  12.         JPanel painel = new JPanel();
  13.        
  14.         painel.setBackground(Color.darkGray);
  15.        
  16.         JButton east = new JButton("east");
  17.         JButton east1 = new JButton("east1");
  18.  
  19.         JButton west = new JButton("west");
  20.         JButton north = new JButton("Nort");
  21.         JButton south = new JButton("South");
  22.         JButton center = new JButton("Center");
  23.        
  24.         janela.getContentPane().add(BorderLayout.EAST, painel);
  25.         painel.add(east);
  26.         painel.add(east1);
  27.        
  28.         janela.getContentPane().add(BorderLayout.WEST, west);
  29.         janela.getContentPane().add(BorderLayout.NORTH, north);
  30.         janela.getContentPane().add(BorderLayout.SOUTH, south);
  31.         janela.getContentPane().add(BorderLayout.CENTER, center);
  32.        
  33.         janela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  34.         janela.setSize(200,200);
  35.         janela.setVisible(true);
  36.     }
  37.    
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement