SetupFrame.java :  » Math » migen » uk » ac » lkl » migen » system » Java Open Source

Java Open Source » Math » migen 
migen » uk » ac » lkl » migen » system » SetupFrame.java
package uk.ac.lkl.migen.system;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import java.util.List;

import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JDialog;

import uk.ac.lkl.common.ui.SwingUtilities2;

import uk.ac.lkl.common.util.datafile.AbstractDataFileManager;
import uk.ac.lkl.common.util.datafile.DataFileManagerSetPanel;

public class SetupFrame extends StartFrame {

    private JButton setupButton;

    private JDialog setupDialog;

    private List<AbstractDataFileManager<?>> dataFileManagers;

    public SetupFrame(List<AbstractDataFileManager<?>> dataFileManagers) {
  super();
  this.dataFileManagers = dataFileManagers;
  addListeners();
    }

    protected JComponent[] getLeftButtonPanelComponents() {
  return new JComponent[] {};
    }

    protected JComponent[] getRightButtonPanelComponents() {
  setupButton = new JButton("Setup");
  return new JComponent[] { setupButton };
    }

    private void addListeners() {
  addSetupButtonListener();
    }

    protected void processStartButtonClicked() {
  if (setupDialog != null)
      setupDialog.dispose();
    }

    private void addSetupButtonListener() {
  setupButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
    showSetupWindow();
      }});
    }

    private void showSetupWindow() {
  if (setupDialog == null) {
      DataFileManagerSetPanel setupPanel = new DataFileManagerSetPanel(dataFileManagers);
      setupDialog = new JDialog(this, "MiGen Setup", true);
      setupDialog.add(setupPanel);
      setupDialog.pack();
  }
  SwingUtilities2.centerWindow(setupDialog);
  setupDialog.setVisible(true);
    }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.