Package fr.um2.physique.risa.gui

Source Code of fr.um2.physique.risa.gui.UserInterface

package fr.um2.physique.risa.gui;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.border.Border;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;

/**
* This class is the main class for Graphical User Interface
*
* @author Emmanuel Hermellin
*
*/
public class UserInterface extends JPanel {

  private static final long serialVersionUID = 7218758652719344049L;
  private static HeaderTab headtab;
  private static ImageTab imagetab;
  private static GaussConvolveTab GCtab;
  private static HistogramTab histogramtab;

  /**
   * Create and setup all the GUI's panels
   */
  public UserInterface() {

    super(new BorderLayout());
   
    GridLayout experimentLayout = new GridLayout(2, 2);

    Border paneEdge = BorderFactory.createEmptyBorder(0, 10, 10, 10);

    JTabbedPane tabbedPane = new JTabbedPane();

    headtab = new HeaderTab();
    JPanel Panel1 = new JPanel();
    Panel1.setBorder(paneEdge);
    Panel1.setLayout(new BoxLayout(Panel1, BoxLayout.Y_AXIS));
    Panel1.add(Box.createRigidArea(new Dimension(2, 10)));
    Panel1.add(headtab.FitsDisplay());
    Panel1.add(headtab.LogDisplay());
    Panel1.add(headtab.HeaderDisplay());
    tabbedPane.addTab("Header", Panel1);

    imagetab = new ImageTab();
    JPanel Panel2 = new JPanel();
    Panel2.setLayout(experimentLayout);
    Panel2.add(imagetab.Picture());
    Panel2.add(imagetab.Math());
    Panel2.add(imagetab.FitsOpen());
    Panel2.add(imagetab.FitsOperation());
    tabbedPane.addTab("Pictures", Panel2);

       
    histogramtab = new HistogramTab();
    JPanel Panel3 = new JPanel();
    Panel3.add(histogramtab.HistogramDisplay());
    tabbedPane.addTab("Histogram", Panel3);
   
    // my gaussian convolution tab
    //author Mathilde SL
    GCtab = new GaussConvolveTab();
    JPanel Panel_gc = new JPanel();
    Panel_gc.add(GCtab.Picture());
    tabbedPane.addTab("Gaussian Convolution", Panel_gc);

    // Add tabbedPane to this panel.
    add(tabbedPane, BorderLayout.CENTER);
   
   
  }

  /**
   * Create the GUI and show it. For thread safety, this method should be
   * invoked from the event-dispatching thread.
   */
  private static void createAndShowGUI() {
    // Create and set up the window.
    JFrame frame = new JFrame("RISA 2011");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Create and set up the content pane.
    UserInterface newContentPane = new UserInterface();
    newContentPane.setOpaque(true); // content panes must be opaque
    frame.setContentPane(newContentPane);

    // Display the window.
    frame.pack();
    frame.setVisible(true);
  }

  public static void main(String[] args) {
    // Schedule a job for the event-dispatching thread:
    // creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        createAndShowGUI();
      }
    });
  }

  /**
   * This method returns the HeaderTab (error log purpose)
   *
   * @return The HeaderTab
   */
  public static HeaderTab getHeaderTab() {
    return headtab;
  }

  /**
   * This method returns the HistogramTab (error log purpose)
   *
   * @return The HistogramTab
   */
  public static HistogramTab getHistogramTab() {
    return histogramtab;
  }
}
TOP

Related Classes of fr.um2.physique.risa.gui.UserInterface

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.