1 package org.mlc.swing.example; 2 3 import org.mlc.swing.layout.*; 4 5 import java.awt.*; 6 import javax.swing.*; 7 8 /*** 9 * @author Michael Connor 10 */ 11 public class ExamplePanel extends javax.swing.JPanel 12 { 13 JLabel nameLabel = new JLabel("Name"); 14 15 JTextField nameText = new JTextField(); 16 17 JTabbedPane tabbedPane = new JTabbedPane(); 18 19 JPanel firstTab = new JPanel(); 20 21 JPanel secondTab = new JPanel(); 22 23 JPanel thirdTab = new JPanel(); 24 25 public ExamplePanel() 26 { 27 super(); 28 org.mlc.swing.layout.LayoutConstraintsManager layoutConstraintsManager = new org.mlc.swing.layout.LayoutConstraintsManager(); 29 setBorder(com.jgoodies.forms.factories.Borders.DIALOG_BORDER); 30 31 layoutConstraintsManager.setLayout("panel", this); 32 layoutConstraintsManager.setLayout("firstTab", firstTab); 33 layoutConstraintsManager.setLayout("secondTab", secondTab); 34 layoutConstraintsManager.setLayout("thirdTab", thirdTab); 35 36 LayoutFrame layoutFrame = new LayoutFrame(layoutConstraintsManager); 37 layoutFrame.setVisible(true); 38 39 this.add(tabbedPane, "tabbedPane"); 40 this.add(nameLabel, "nameLabel"); 41 this.add(nameText, "nameText"); 42 tabbedPane.add("First", firstTab); 43 tabbedPane.add("Second", secondTab); 44 tabbedPane.add("Third", thirdTab); 45 } 46 47 public static void main(String[] args) 48 { 49 ExamplePanel examplePanel = new ExamplePanel(); 50 51 JFrame frame = new JFrame("Example"); 52 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 53 frame.getContentPane().setLayout(new BorderLayout()); 54 frame.getContentPane().add(examplePanel, BorderLayout.CENTER); 55 frame.setSize(400, 500); 56 frame.setVisible(true); 57 } 58 59 }