Gui java
Combinacao.java package Layouts;
import java.awt.*; import javax.swing.*;
/** * * @author Elisângela */ public class Combinacao {
public static void main(String[] args) { JFrame janela = new JFrame("Combinações"); JPanel painel1 = new JPanel(new FlowLayout(FlowLayout.LEFT)); JPanel painel2 = new JPanel(new BorderLayout()); Container content = janela.getContentPane();
janela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton botao1 = new JButton("JButton"); JButton botao2 = new JButton("JButton"); JTextArea textArea = new JTextArea("JTextArea"); //content.setLayout(new FlowLayout());
painel1.add(botao1); painel1.add(botao2); painel2.add(textArea); content.add(painel1,BorderLayout.NORTH); content.add(painel2, BorderLayout.CENTER); janela.pack(); janela.setSize(300,300); janela.setVisible(true); }
}
LayoutManagerDemo1.java (pacote Layouts) package Layouts;
import java.awt.*; import javax.swing.*;
/** * * @author Elisângela */ public class LayoutManagerDemo1 {
public static void main(String[] args) {
JFrame janela = new JFrame("Layout Manager Demo 1"); janela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); janela.setSize(300, 300); janela.setVisible(true); Container content = janela.getContentPane(); JButton botao1 = new JButton("Botao 1"); JButton botao2 = new JButton("Botao 2"); JButton botao3 = new JButton("Botao 3"); JButton botao4 = new JButton("Botao 4"); JButton botao5 = new JButton("Botao 5"); JButton botao6 = new JButton("Botao 6");
botao1.setBounds(10, 10, 100, 30); botao2.setBounds(10, 50, 100, 30); botao3.setBounds(10, 90, 100, 30); botao4.setBounds(10, 130, 100, 30);