コード例 #1
0
  // Constructor
  public ParticleGeneratePanel(ParticleList particleList, UintahGui parent) {

    // Copy the arguments
    d_particleList = particleList;

    // Initialize particle size distribution
    d_partSizeDist = new ParticleSize();

    // Create the tabbed pane
    partTabbedPane = new JTabbedPane();

    // Create the panels to be added to the tabbed pane
    particleSizeInputPanel = new ParticleSizeDistInputPanel(d_partSizeDist, this);
    particleLocGenPanel = new ParticleLocGeneratePanel(d_particleList, d_partSizeDist, this);

    // Add the tabs
    partTabbedPane.addTab("Size Distribution", null, particleSizeInputPanel, null);
    partTabbedPane.addTab("Generate Locations", null, particleLocGenPanel, null);
    partTabbedPane.setSelectedIndex(0);

    // Create a grid bag
    GridBagLayout gb = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();
    setLayout(gb);

    // Set the constraints for the tabbed pane
    UintahGui.setConstraints(gbc, GridBagConstraints.CENTER, 1.0, 1.0, 0, 1, 1, 1, 5);
    gb.setConstraints(partTabbedPane, gbc);
    add(partTabbedPane);

    // Add the change listener
    partTabbedPane.addChangeListener(this);
  }
コード例 #2
0
  // If the applet is called as an application
  public static void main(String[] args) {

    // Create the frame
    mainFrame = new JFrame("Uintah User Interface");

    // Add a window listener
    mainFrame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });

    // instantiate
    UintahGui uintahGui = new UintahGui();
    uintahGui.init();

    // Add the stuff to the frame
    mainFrame.setLocation(20, 50);
    mainFrame.setContentPane(uintahGui);
    mainFrame.pack();
    mainFrame.setVisible(true);
  }