Package jpianotrain.gui.action

Source Code of jpianotrain.gui.action.HyperTonnetzAction

/* For License see bottom */
package jpianotrain.gui.action;

import static jpianotrain.util.ResourceKeys.ACTION_HYPERTONNETZ_NAME;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;

import javax.swing.JDialog;

import jpianotrain.ApplicationContext;
import jpianotrain.gui.TonnetzMajorPanel;
import jpianotrain.staff.Tonnetz;
import jpianotrain.util.ResourceFactory;

/**
*
* @author onkobu
* @since 0.0.3
*/
public class HyperTonnetzAction extends AbstractAction {
  public HyperTonnetzAction() {
    super(ACTION_HYPERTONNETZ_NAME);
  }
 
  @Override
  public void actionPerformed(ActionEvent e) {
    Tonnetz t=new Tonnetz(Tonnetz.Sort.WHOLESTEP, 8);
    t=t.merge(new Tonnetz(Tonnetz.Sort.WHOLESTEP, 2));
    //Tonnetz t=new Tonnetz(Tonnetz.Sort.WHOLESTEP, 2);
    TonnetzMajorPanel tmp=new TonnetzMajorPanel(t);
    if (dlg==null) {
      dlg=new JDialog(ApplicationContext.getInstance().getDefaultDialogOwner(),
        ResourceFactory.getString(ACTION_HYPERTONNETZ_NAME),
        false);
      dlg.setLayout(new BorderLayout());
      dlg.add(tmp, BorderLayout.CENTER);
      dlg.pack();
      //Dimension d=dlg.getSize();
      //d.setSize(new Dimension(d.width, d.height+200));
    }

    if (dlg.isVisible()) {
      dlg.toFront();
    } else {
      dlg.setVisible(true);
    }
  }

  private JDialog dlg;
}

/*
    Copyright (C) 2008  Alexander Methke

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program (gplv3.txt).
*/
TOP

Related Classes of jpianotrain.gui.action.HyperTonnetzAction

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.