⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inputmodifiers.java

📁 FuncPlotter is a combined Java application and applet for displaying two-dimensional plots of explic
💻 JAVA
字号:
/*====================================================================*\InputModifiers.javaInput modifiers enumeration.------------------------------------------------------------------------This file is part of FuncPlotter, a combined Java application and appletfor plotting explicit functions in one variable.Copyright 2005-2007 Andy Morgan-Richards.FuncPlotter is free software: you can redistribute it and/or modify itunder the terms of the GNU General Public License as published by theFree Software Foundation, either version 3 of the License, or (at youroption) any later version.This program is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public License alongwith this program.  If not, see <http://www.gnu.org/licenses/>.\*====================================================================*/// PACKAGEpackage util;//----------------------------------------------------------------------// IMPORTSimport java.awt.event.InputEvent;//----------------------------------------------------------------------// INPUT MODIFIERSpublic enum InputModifiers{//////////////////////////////////////////////////////////////////////////  Constants////////////////////////////////////////////////////////////////////////    NONE            ( 0 ),    SHIFT           ( InputEvent.SHIFT_DOWN_MASK ),    CTRL            ( InputEvent.CTRL_DOWN_MASK ),    ALT             ( InputEvent.ALT_DOWN_MASK ),    CTRL_SHIFT      ( InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK ),    ALT_SHIFT       ( InputEvent.ALT_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK ),    ALT_CTRL        ( InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK ),    ALT_CTRL_SHIFT  ( InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK ),    UNRECOGNISED    ( 0 );    public static final int MASK    = InputEvent.ALT_DOWN_MASK | InputEvent.ALT_GRAPH_DOWN_MASK |                                                    InputEvent.CTRL_DOWN_MASK | InputEvent.META_DOWN_MASK |                                                    InputEvent.SHIFT_DOWN_MASK;//////////////////////////////////////////////////////////////////////////  Constructors////////////////////////////////////////////////////////////////////////    private InputModifiers( int mask )    {        this.mask = mask;    }    //------------------------------------------------------------------//////////////////////////////////////////////////////////////////////////  Class methods////////////////////////////////////////////////////////////////////////    public static InputModifiers get( int modifiers )    {        int value = modifiers & MASK;        for ( InputModifiers mod : values( ) )        {            if ( mod.mask == value )                return mod;        }        return UNRECOGNISED;    }    //------------------------------------------------------------------    public static InputModifiers get( InputEvent event )    {        return get( event.getModifiersEx( ) );    }    //------------------------------------------------------------------//////////////////////////////////////////////////////////////////////////  Instance methods////////////////////////////////////////////////////////////////////////    public boolean isShift( )    {        return ( (mask & InputEvent.SHIFT_DOWN_MASK) != 0 );    }    //------------------------------------------------------------------    public boolean isControl( )    {        return ( (mask & InputEvent.CTRL_DOWN_MASK) != 0 );    }    //------------------------------------------------------------------    public boolean isAlt( )    {        return ( (mask & InputEvent.ALT_DOWN_MASK) != 0 );    }    //------------------------------------------------------------------//////////////////////////////////////////////////////////////////////////  Instance variables////////////////////////////////////////////////////////////////////////    private int mask;}//----------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -