/* * @(#)GlobalPanel.java 1.4 98/06/29 * * Copyright 1998 by Sun Microsystems, Inc., * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. * All rights reserved. * * This software is the confidential and proprietary information * of Sun Microsystems, Inc. ("Confidential Information"). You * shall not disclose such Confidential Information and shall use * it only in accordance with the terms of the license agreement * you entered into with Sun. */ import java.awt.GridBagLayout; import java.awt.BorderLayout; import com.sun.java.swing.JPanel; import com.sun.java.swing.JTabbedPane; import com.sun.java.swing.border.*; import com.sun.java.swing.event.ChangeEvent; import com.sun.java.swing.event.ChangeListener; /** * Panel that holds the layouts, Controls and Monitors for each tab. * It's a special "always visible" panel for the Controls, MemoryMonitor & * PerformanceMonitor. */ public class GlobalPanel extends JPanel implements ChangeListener { public GlobalPanel() { setLayout(new BorderLayout()); JPanel p = new JPanel(new GridBagLayout()); EmptyBorder eb = new EmptyBorder(5,0,5,5); BevelBorder bb = new BevelBorder(BevelBorder.LOWERED); p.setBorder(new CompoundBorder(eb,bb)); Java2Demo.addToGridBag(p,Java2Demo.controls,0,0,1,1,0,0); Java2Demo.addToGridBag(p,Java2Demo.memorymonitor,0,1,1,1,0,0); Java2Demo.addToGridBag(p,Java2Demo.performancemonitor,0,2,1,1,0,0); add(p, BorderLayout.EAST); } private int index; public void stateChanged(ChangeEvent e) { JTabbedPane tabPane = (JTabbedPane) e.getSource(); remove(Java2Demo.layouts[index]); index= tabPane.getSelectedIndex(); add(Java2Demo.layouts[index]); Java2Demo.layouts[index].setup(); validate(); } }