ActOpenPlayer.java :  » Swing-Library » swingexplorer » org » swingexplorer » Java Open Source

Java Open Source » Swing Library » swingexplorer 
swingexplorer » org » swingexplorer » ActOpenPlayer.java
/*
 * Swing Explorer. Tool for developers exploring Java/Swing-based application internals. 
 * Copyright (C) 2008, Maxim Zakharenkov
 *
 * 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 2 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; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 * 
 * $Header: /cvs/swingexplorer/src/org/swingexplorer/ActOpenPlayer.java,v 1.2 2008/02/06 08:36:09 maxz1 Exp $
 */
package org.swingexplorer;


import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JDialog;

/**
 * 
 * @author Maxim Zakharenkov
 */
public class ActOpenPlayer extends RichToggleAction {

  MdlSwingExplorer model;
  
  ActOpenPlayer(MdlSwingExplorer modelP) {
    setName("Open Player");
    setTooltip("Open Player");
    setIcon(DefaultIcon.INSTANCE);
    model = modelP;
  }
  
  public void actionPerformed(ActionEvent e) {
    setSelected(!isSelected());
    
    if (application.dlgPlayerControls == null) {
      application.dlgPlayerControls = new JDialog(application.frmMain,
          "Player");
      PNLPlayerControls pnlPlayerControls = new PNLPlayerControls();
      application.dlgPlayerControls.add(pnlPlayerControls);
      pnlPlayerControls.setPlayer(application.player);
      application.dlgPlayerControls.setBounds(380, 450, 590, 280);
      
      application.dlgPlayerControls.addWindowListener(new WindowAdapter(){
        @Override
        public void windowClosing(WindowEvent e) {
          ActOpenPlayer.this.setSelected(false);
        }
      });
    }
    application.dlgPlayerControls.setVisible(isSelected());    
  }

}

/*
 * $Log: ActOpenPlayer.java,v $
 * Revision 1.2  2008/02/06 08:36:09  maxz1
 * Changed license header
 *
 * Revision 1.1  2007/06/27 19:41:38  maxz1
 * new
 *
 */
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.