Layout

Como eu faço ara colocar um botão embaixo do outro utilizando FlowLayout??
vo colocar o código logo baixo…

 
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
 


public class CriptografiaGUI  extends JFrame implements ActionListener
{
	/**
	 * 
	 */
	 
	private Color cor;
	private JButton botao;
	private JButton botao2;//este botão que quero colocar embaxo do 1
	private JTextArea textArea1;
	private JTextArea textArea2;
	private JLabel texto;
	 
	 
	 
	Criptografia chama = new Criptografia();
	
	public CriptografiaGUI(String titulo)
	{
		super(titulo);
		
		setLayout(new FlowLayout());
		 
 
		
		this.textArea1= new JTextArea(10,10);
		add(new JScrollPane(this.textArea1));
		
	 
		
 
		this.botao=new JButton("Criptografar >>");
		this.botao.setBackground(cor.yellow);
		this.botao.addActionListener(this);
		add(this.botao);
		
		
		this.textArea2= new JTextArea(10,10);
		add(new JScrollPane(this.textArea2));
		add(new JScrollPane(this.textArea2));
		 
		 
 
		
		 
		
		this.botao2 = new JButton("Descriptografar >>");
		this.botao2.setBackground(this.cor.blue);
		this.botao2.addActionListener(this);
		add(this.botao2);
		 
		 
		 
		
 
		getContentPane().setBackground(cor.orange);
		setVisible(true);
		pack();
		setSize(700, 300);
		setResizable(false);
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		
		
	}
	
	public void actionPerformed(ActionEvent event) 
	{
	          if(event.getActionCommand().equals("Criptografar >>"))
	          {
	        	  	String pega;
	        	 
	        	  		if(this.textArea1.getText().equals(""))
	        	  		{
	        	  			this.textArea2.setText("Não foi digitado nenhum caracter ");
	        	  			setLimpaTextArea1();
	        		
	        	  		}
	        	  		else 
	        	  		{
	        		
	        	  			pega=this.textArea1.getText();
	        	  			chama.setTrataString(pega);
	        	  			setLimpaTextArea1();
	        	  			this.textArea2.setText(pega);
	        	  		}
	        	 
	          }
	          
	          if(event.getActionCommand().equals("Descriptografar >>"))
	          {
	        		 
	        		 this.textArea2.setEditable(true);
	        		 this.textArea1.setEditable(false);
	        		 
	         }
	}
	
	
	public void setLimpaTextArea1()
	{
		this.textArea1.setText("");
	}
	
	public void setLimpaTextArea2()
	{
		this.textArea2.setText("");
	}
	

	public static void main(String args[])
	{
		new CriptografiaGUI("Trabalho de Matématica discreta");
	}

}




[color=darkblue] Você está usando o FlowLayout, ele estende os objetos, exemplo você tem um botão ele configura um ao lado do outro, o que você pode utilizar é GridLayout, esse funciona como uma matriz, se você definir ele como (3,1) ele adiciona os objetos em formato de matriz 3 objetos por 1 coluna[/color]

Olha esse link:
http://java.sun.com/docs/books/tutorial/uiswing/layout/flow.html

Deve ajudar! :wink: