001/* 002Below is the copyright agreement for the Ptolemy II system. 003Version: $Id$ 004 005Copyright (c) 2007-2009 The Regents of the University of California. 006All rights reserved. 007 008Permission is hereby granted, without written agreement and without 009license or royalty fees, to use, copy, modify, and distribute this 010software and its documentation for any purpose, provided that the above 011copyright notice and the following two paragraphs appear in all copies 012of this software. 013 014IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY 015FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 016ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF 017THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF 018SUCH DAMAGE. 019 020THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, 021INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 022MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE 023PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF 024CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, 025ENHANCEMENTS, OR MODIFICATIONS. 026 */ 027package org.mlc.swing.example; 028 029import java.awt.BorderLayout; 030 031import javax.swing.JFrame; 032import javax.swing.JLabel; 033import javax.swing.JPanel; 034import javax.swing.JTabbedPane; 035import javax.swing.JTextField; 036import javax.swing.WindowConstants; 037 038import org.mlc.swing.layout.LayoutFrame; 039 040/** An example. 041 * @author Michael Connor 042 * @version $Id$ 043 * @since Ptolemy II 8.0 044 */ 045@SuppressWarnings("serial") 046public class ExamplePanel extends javax.swing.JPanel { 047 JLabel nameLabel = new JLabel("Name"); 048 049 JTextField nameText = new JTextField(); 050 051 JTabbedPane tabbedPane = new JTabbedPane(); 052 053 JPanel firstTab = new JPanel(); 054 055 JPanel secondTab = new JPanel(); 056 057 JPanel thirdTab = new JPanel(); 058 059 /** Create the ExamplePanel. */ 060 public ExamplePanel() { 061 super(); 062 org.mlc.swing.layout.LayoutConstraintsManager layoutConstraintsManager = new org.mlc.swing.layout.LayoutConstraintsManager(); 063 setBorder(com.jgoodies.forms.factories.Borders.DIALOG_BORDER); 064 065 layoutConstraintsManager.setLayout("panel", this); 066 layoutConstraintsManager.setLayout("firstTab", firstTab); 067 layoutConstraintsManager.setLayout("secondTab", secondTab); 068 layoutConstraintsManager.setLayout("thirdTab", thirdTab); 069 070 LayoutFrame layoutFrame = new LayoutFrame(layoutConstraintsManager); 071 layoutFrame.setVisible(true); 072 073 this.add(tabbedPane, "tabbedPane"); 074 this.add(nameLabel, "nameLabel"); 075 this.add(nameText, "nameText"); 076 tabbedPane.add("First", firstTab); 077 tabbedPane.add("Second", secondTab); 078 tabbedPane.add("Third", thirdTab); 079 } 080 081 /** Run the CustomerPanel example. 082 * @param args Not used. 083 */ 084 public static void main(String[] args) { 085 ExamplePanel examplePanel = new ExamplePanel(); 086 087 JFrame frame = new JFrame("Example"); 088 frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); 089 frame.getContentPane().setLayout(new BorderLayout()); 090 frame.getContentPane().add(examplePanel, BorderLayout.CENTER); 091 frame.setSize(400, 500); 092 frame.setVisible(true); 093 } 094 095}