2 //Title: OpenCASCADE Samples
4 //Copyright: Copyright (c) 1999
5 //Author: User Interface group
6 //Company: Matra Datavision
10 import java.awt.event.*;
12 import javax.swing.event.*;
16 public class SamplesTopologyPanel extends JPanel
17 implements ChangeListener
19 private Component myCurrentPage = null;
20 private JTabbedPane myTabbedPane = null;
22 //=======================================================================//
24 //=======================================================================//
25 public SamplesTopologyPanel()
27 setLayout(new BorderLayout());
29 //-----------------------------------------------------------//
31 //-----------------------------------------------------------//
32 myTabbedPane = new JTabbedPane();
33 myTabbedPane.setVisible(false);
34 myTabbedPane.addChangeListener(this);
35 add(myTabbedPane, BorderLayout.CENTER);
37 // The Topology Primitives sample
38 myTabbedPane.addTab("Topology Primitives", new SampleTopologyPrimitivesPanel());
40 // The Topological Operations sample
41 myTabbedPane.addTab("Topological Operations", new SampleTopologicalOperationsPanel());
43 // The Topology Building sample
44 myTabbedPane.addTab("Topology Building", new SampleTopologyBuildingPanel());
46 // The Topology Analysis sample
47 myTabbedPane.addTab("Topology Analysis", new SampleTopologyAnalysisPanel());
49 // The Topology Transformations sample
50 myTabbedPane.addTab("Topology Transformations", new SampleTopologyTransformationsPanel());
52 // The Local Operations sample
53 myTabbedPane.addTab("Local Operations", new SampleLocalOperationsPanel());
55 // The Triangulation sample
56 myTabbedPane.addTab("Triangulation", new SampleTriangulationPanel());
58 myTabbedPane.setSelectedIndex(0);
61 //-----------------------------------------------------------------------//
62 public void setVisible(boolean b)
65 myTabbedPane.setVisible(b);
66 if (myCurrentPage != null)
67 myCurrentPage.setVisible(b);
68 if (b) this.validate();
72 //=======================================================================//
74 //=======================================================================//
75 public void stateChanged(ChangeEvent event)
77 SamplesStarter.put_info("");
79 JTabbedPane tab = (JTabbedPane) event.getSource();
80 int index = tab.getSelectedIndex();
81 Component currentPage = tab.getComponentAt(index);
83 if (myCurrentPage != null)
85 myCurrentPage.setVisible(false);
86 myCurrentPage.setEnabled(false);
87 currentPage.setVisible(true);
88 currentPage.setEnabled(true);
92 currentPage.setVisible(false);
93 currentPage.setEnabled(false);
95 myCurrentPage = currentPage;