You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
INTERFACE GRÁFICA CO M O USUÁRIO<br />
}<br />
}<br />
restricoes.gridwidth = GridBagConstraints.RELATIVE;<br />
restricoes.weightx = 0.0; // Componente com peso padrão - igual aos outros<br />
restricoes.weighty = 3.0;<br />
adicionarComponente(new Button("botão 1"), gerenciador, restricoes);<br />
// depois de um RELATIVE sempre deve vir um REMAINDER<br />
restricoes.gridwidth = GridBagConstraints.REMAINDER;<br />
adicionarComponente(new Button("botão 2"), gerenciador, restricoes);<br />
restricoes.gridwidth = 1; // recupera os padrões de alocação de espaço<br />
restricoes.gridheight = 2; // na grade<br />
restricoes.weightx = 0.0;<br />
restricoes.weighty = 1.0;<br />
Button botao3 = new Button("botão 3");<br />
botao3.setBackground(Color.cyan);<br />
adicionarComponente(botao3, gerenciador, restricoes);<br />
adicionarComponente(new Button("botão 4"), gerenciador, restricoes);<br />
adicionarComponente(new Button("botão 5"), gerenciador, restricoes);<br />
adicionarComponente(new Button("botão 6"), gerenciador, restricoes);<br />
restricoes.gridwidth = GridBagConstraints.REMAINDER;<br />
// Adicionando um container dentro do de uma célula<br />
Panel painel = new Panel();<br />
painel.setLayout(new GridLayout(2,2,2,2));<br />
painel.add(new Label("campo 1"));<br />
painel.add(new TextField());<br />
painel.add(new Label("campo 2"));<br />
painel.add(new TextField());<br />
adicionarComponente(painel, gerenciador, restricoes);<br />
restricoes.weighty = 1.7;<br />
restricoes.fill = GridBagConstraints.BOTH;<br />
Label fic = new Label("FACULDADE INTEGRADA DO CEARÁ", Label.CENTER);<br />
fic.setBackground(Color.black);<br />
fic.setForeground(Color.white);<br />
fic.setFont(new Font("Serif", Font.BOLD, 16));<br />
adicionarComponente(fic, gerenciador, restricoes);<br />
setSize(375,300);<br />
setVisible(true);<br />
static public void main(String[] args)<br />
{<br />
new GradeAssimetrica();<br />
}<br />
96