Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/sshtools/sshterm/FullScreenAction.java


1   /*
2    *  Sshtools - SSHTerm
3    *
4    *  Copyright (C) 2002 Lee David Painter.
5    *
6    *  Written by: 2002 Lee David Painter <lee@sshtools.com>
7    *
8    *  This program is free software; you can redistribute it and/or
9    *  modify it under the terms of the GNU General Public License
10   *  as published by the Free Software Foundation; either version 2 of
11   *  the License, or (at your option) any later version.
12   *  This program is distributed in the hope that it will be useful,
13   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   *  GNU Library General Public License for more details.
16   *
17   *  You should have received a copy of the GNU General Public
18   *  License along with this program; if not, write to the Free Software
19   *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20   */
21  package com.sshtools.sshterm;
22  
23  import com.sshtools.apps.SshToolsApplication;
24  import com.sshtools.apps.SshToolsApplicationContainer;
25  import com.sshtools.apps.StandardAction;
26  
27  import org.apache.log4j.Logger;
28  
29  import java.awt.event.ActionEvent;
30  import java.awt.event.KeyEvent;
31  
32  import javax.swing.Action;
33  import javax.swing.KeyStroke;
34  
35  
36  public class FullScreenAction extends StandardAction {
37      protected static Logger log = Logger.getLogger(FullScreenAction.class);
38      private final static String ACTION_COMMAND_KEY_FULL_SCREEN = "full-screen-command";
39      private final static String NAME_FULL_SCREEN = "Full Screen";
40      private final static String SMALL_ICON_FULL_SCREEN = "fullscreen.png";
41      private final static String LARGE_ICON_FULL_SCREEN = "";
42      private final static String SHORT_DESCRIPTION_FULL_SCREEN = "Toggle full screen";
43      private final static String LONG_DESCRIPTION_FULL_SCREEN = "Toggle full screen mode";
44      private final static int MNEMONIC_KEY_FULL_SCREEN = 'f';
45  
46      //
47      private SshToolsApplication application;
48      private SshToolsApplicationContainer container;
49  
50      public FullScreenAction(SshToolsApplication application,
51          SshToolsApplicationContainer container) {
52          this.application = application;
53          this.container = container;
54  
55          putValue(Action.NAME, NAME_FULL_SCREEN);
56          putValue(Action.SMALL_ICON, getIcon(SMALL_ICON_FULL_SCREEN));
57          putValue(LARGE_ICON, getIcon(LARGE_ICON_FULL_SCREEN));
58          putValue(Action.ACCELERATOR_KEY,
59              KeyStroke.getKeyStroke(KeyEvent.VK_F, KeyEvent.ALT_MASK));
60          putValue(Action.SHORT_DESCRIPTION, SHORT_DESCRIPTION_FULL_SCREEN);
61          putValue(Action.LONG_DESCRIPTION, LONG_DESCRIPTION_FULL_SCREEN);
62          putValue(Action.MNEMONIC_KEY, new Integer(MNEMONIC_KEY_FULL_SCREEN));
63          putValue(Action.ACTION_COMMAND_KEY, ACTION_COMMAND_KEY_FULL_SCREEN);
64          putValue(StandardAction.ON_MENUBAR, new Boolean(true));
65          putValue(StandardAction.MENU_NAME, "View");
66          putValue(StandardAction.MENU_ITEM_GROUP, new Integer(20));
67          putValue(StandardAction.MENU_ITEM_WEIGHT, new Integer(20));
68          putValue(StandardAction.ON_TOOLBAR, new Boolean(true));
69          putValue(StandardAction.TOOLBAR_GROUP, new Integer(5));
70          putValue(StandardAction.TOOLBAR_WEIGHT, new Integer(30));
71      }
72  
73      public void actionPerformed(ActionEvent evt) {
74          SshTerminalPanel p = (SshTerminalPanel) container.getApplicationPanel();
75          System.out.println("++++ full screen is currently "
76              + p.isFullScreenMode());
77          p.setFullScreenMode(!p.isFullScreenMode());
78      }
79  }