001 package org.shiftone.jrat.desktop.action.file; 002 003 import org.shiftone.jrat.util.log.Logger; 004 005 import javax.swing.*; 006 import java.awt.event.ActionEvent; 007 import java.awt.event.KeyEvent; 008 009 /** 010 * @author jeff@shiftone.org (Jeff Drost) 011 */ 012 public class CloseAction extends AbstractAction { 013 014 private static final Logger LOG = Logger.getLogger(CloseAction.class); 015 private final JTabbedPane tabbedPane; 016 017 public CloseAction(JTabbedPane tabbedPane) { 018 super("Close"); 019 putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_C)); 020 this.tabbedPane = tabbedPane; 021 } 022 023 public void actionPerformed(ActionEvent e) { 024 int index = tabbedPane.getSelectedIndex(); 025 if (index != -1) { 026 tabbedPane.remove(index); 027 } 028 } 029 }