anl.verdi.plot.anim.MultPlotAnimationDialog.java Source code

Java tutorial

Introduction

Here is the source code for anl.verdi.plot.anim.MultPlotAnimationDialog.java

Source

package anl.verdi.plot.anim;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dialog;
import java.awt.Frame;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.WindowConstants;

import anl.verdi.plot.gui.Plot;

import com.jgoodies.forms.factories.Borders;
import com.jgoodies.forms.factories.FormFactory;
import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.RowSpec;

/**
 * @author User #2
 */
public class MultPlotAnimationDialog extends JDialog {
    /**
     * 
     */
    private static final long serialVersionUID = 3698011361360368805L;

    public MultPlotAnimationDialog(Frame owner) {
        super(owner);
        initComponents();
    }

    public MultPlotAnimationDialog(Dialog owner) {
        super(owner);
        initComponents();
    }

    public void init(java.util.List<Plot> plots) {
        animationPanel.init(startBtn, plots);
    }

    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
        // Generated using JFormDesigner non-commercial license
        dialogPane = new JPanel();
        contentPanel = new JPanel();
        animationPanel = new MultiPlotAnimation();
        buttonBar = new JPanel();
        startBtn = new JButton();
        CellConstraints cc = new CellConstraints();

        //======== this ========
        setTitle("Animate Plots");
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        Container contentPane = getContentPane();
        contentPane.setLayout(new BorderLayout());

        //======== dialogPane ========
        {
            dialogPane.setBorder(Borders.DIALOG_BORDER);
            dialogPane.setLayout(new BorderLayout());

            //======== contentPanel ========
            {
                contentPanel.setLayout(new BorderLayout());
                contentPanel.add(animationPanel, BorderLayout.CENTER);
            }
            dialogPane.add(contentPanel, BorderLayout.CENTER);

            //======== buttonBar ========
            {
                buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
                // 2014
                RowSpec[] aRowSpec = RowSpec.decodeSpecs("pref");
                buttonBar.setLayout(new FormLayout(
                        new ColumnSpec[] { FormFactory.GLUE_COLSPEC, FormFactory.BUTTON_COLSPEC }, aRowSpec));
                //            buttonBar.setLayout(new FormLayout(
                //                  new ColumnSpec[] {
                //                     FormFactory.GLUE_COLSPEC,
                //                     FormFactory.BUTTON_COLSPEC
                //                  },
                //                  RowSpec.decodeSpecs("pref")));

                //---- startBtn ----
                startBtn.setText("Start");
                buttonBar.add(startBtn, cc.xy(2, 1));
            }
            dialogPane.add(buttonBar, BorderLayout.SOUTH);
        }
        contentPane.add(dialogPane, BorderLayout.CENTER);
        pack();
        setLocationRelativeTo(getOwner());
        // JFormDesigner - End of component initialization  //GEN-END:initComponents
    }

    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
    // Generated using JFormDesigner non-commercial license
    private JPanel dialogPane;
    private JPanel contentPanel;
    private MultiPlotAnimation animationPanel;
    private JPanel buttonBar;
    private JButton startBtn;
    // JFormDesigner - End of variables declaration  //GEN-END:variables
}