|
Thiago
vc tem que combinar v�rios Paineis com v�rios layout.
Segue
um exemplo que faz o que vc quer :
import java.awt.FlowLayout;
import java.awt.GridLayout;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;/** * <p> * * </p> * */public class TestPanel extends JPanel { public TestPanel() { super();init(); } /** * */ private void init() {FlowLayout flowLayout = new FlowLayout(FlowLayout.LEFT,5,5); // Cria um primeiro painel para a sua primeira linhaJPanel linha1 = new JPanel(flowLayout);linha1.add( new JLabel("Nome"));linha1.add( new JLabel("Olivier")); // Cria um segundoJPanel linha2 = new JPanel(flowLayout);linha2.add( new JLabel("Endere�o"));linha2.add( new JLabel("Rio")); // Seta o layout do painel corrente como GridBag com uma coluna e duas linhassetLayout( new GridLayout(2, 1)); // acrescenta os dois paineisadd(linha1); add(linha2); } public static void main(String[] args) {JFrame.setDefaultLookAndFeelDecorated( true);JFrame frame = new JFrame("Teste");JPanel panel = new TestPanel();frame.getContentPane().add(panel); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.pack(); frame.setVisible( true);} }
Olivier
|
- RES: [JUG-Petro] Ajuda no Swing!!! Olivier - (JConcept / Cetip21)
- Re: [JUG-Petro] Ajuda no Swing!!! Thiago Meireles
- Olivier - (JConcept / Cetip21)
