Example usage for java.awt.event KeyEvent VK_S

List of usage examples for java.awt.event KeyEvent VK_S

Introduction

In this page you can find the example usage for java.awt.event KeyEvent VK_S.

Prototype

int VK_S

To view the source code for java.awt.event KeyEvent VK_S.

Click Source Link

Document

Constant for the "S" key.

Usage

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java

private void checkHotKey(java.awt.event.KeyEvent evt) {
    if ((evt.getModifiersEx() & InputEvent.ALT_DOWN_MASK) != 0) {
        if (evt.getKeyCode() == KeyEvent.VK_1) {
            showSearch(true);//from  w  w w  .  j  a v a  2s. c  o m
        } else if (evt.getKeyCode() == KeyEvent.VK_2) {
            showMetaData(true);
        }
    } else if ((evt.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0) {
        if (evt.getKeyCode() == KeyEvent.VK_S) {
            showSearch(true);
        } else if (evt.getKeyCode() == KeyEvent.VK_M) {
            showMetaData(true);
        }
    }
    if (evt.getKeyCode() == KeyEvent.VK_F5) {
        depositPresenter.refreshFileList();
    }
}

From source file:src.gui.ItSIMPLE.java

/**
 * This method initializes saveMenuItem// w w  w  .  j a v  a2 s . c o  m
 *
 * @return javax.swing.JMenuItem
 */
private JMenuItem getSaveMenuItem() {
    if (saveMenuItem == null) {
        saveMenuItem = new JMenuItem(saveAction);
        saveMenuItem.setEnabled(false);
        saveMenuItem.setMnemonic(KeyEvent.VK_S);
        saveMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK, true));
    }
    return saveMenuItem;
}

From source file:src.gui.ItSIMPLE.java

/**
 * This method initializes settingsMenu//from   www  . j  av a  2s . c  o  m
 *
 * @return javax.swing.JMenu
 */
private JMenu getSettingsMenu() {
    if (settingsMenu == null) {
        settingsMenu = new JMenu();
        settingsMenu.setText("Settings");
        settingsMenu.setMnemonic(KeyEvent.VK_S);
        settingsMenu.add(getAppearanceMenu());
        settingsMenu.add(getPlannersSettingsMenuItem());
    }
    return settingsMenu;
}

From source file:src.gui.ItSIMPLE.java

/**
 * This method initializes helpMenu/* w  w  w  .  ja  va  2  s . c o  m*/
 *
 * @return javax.swing.JMenu
 */
private JMenu getHelpMenu() {
    if (helpMenu == null) {
        helpMenu = new JMenu();
        helpMenu.setText("Help");
        helpMenu.setMnemonic(KeyEvent.VK_S);
        helpMenu.add(getAboutMenuItem());
        helpMenu.add(getCheckUpdatesMenuItem());

    }
    return helpMenu;
}

From source file:base.BasePlayer.Main.java

@Override

public void keyPressed(KeyEvent e) {
    keyCode = e.getKeyCode();/*from  ww  w . j  a va 2  s  .  com*/

    if (!Main.shift && (e.getModifiers() & KeyEvent.SHIFT_MASK) != 0) {

        Main.shift = true;
    } else if ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0) {
        Main.drawCanvas.ctrlpressed = 100;

        if (keyCode == KeyEvent.VK_S) {

            if (drawCanvas.drawVariables.projectName.equals("Untitled")) {
                saveProjectAs.doClick();
            } else {
                Serializer ser = new Serializer();
                ser.serialize(drawCanvas.drawVariables.projectFile);
            }
        }
        if (keyCode == KeyEvent.VK_W) {

            //   System.out.println("\n----\n");

            /*
               int[][] array = new int[Main.varsamples][VariantHandler.callSlider.getUpperValue()+1];
                       
                  for(int i = 0; i<array.length; i++) {
                     for(int j = 0; j<array[i].length; j++) {
             array[i][j] = 0;
                     }
                  }
                  /*VarNode node = FileRead.head.getNext();
                  int counter = 0;
                  while(node != null) {
                     if(!drawCanvas.hideNode(node)) {               
             counter++;
             for(int i = 0; i<node.vars.size(); i++) {
                if(!drawCanvas.hideNodeVar(node, node.vars.get(i))) {
                   for(int j = 0;j<node.vars.get(i).getValue().size(); j++) {
                      if(!drawCanvas.hideVar(node.vars.get(i).getValue().get(j), false)) {
                         array[node.vars.get(i).getValue().get(j).getSample().getIndex()][(int)(MethodLibrary.round(node.vars.get(i).getValue().get(j).getAlleleFraction()*100,2))]++;
                      }
                              
                   }
                           
                           
                }                  
             }
                     }
                       
                     node = node.getNext();
                  }*/
            /*   int width = Main.drawCanvas.getWidth()-Main.sidebarWidth;
                    
               JPopupMenu menu = new JPopupMenu();
            Plotter plotter = new Plotter(width);         
            plotter.setPreferredSize(new Dimension(width,400));
            menu.add(plotter);
            menu.pack();
            menu.show(Main.drawCanvas,Main.sidebarWidth, drawScroll.getVerticalScrollBar().getValue());
            */
        }
        if (keyCode == KeyEvent.VK_PLUS || keyCode == 107) {

            //      defaultFontSize++;

            //      setFonts();
        }
        if (keyCode == KeyEvent.VK_M || keyCode == KeyEvent.VK_MINUS || keyCode == 109) {

            //      defaultFontSize--;

            //      setFonts();
        }
        /*   else if(keyCode == KeyEvent.VK_M) {
              VarNode current = FileRead.head.getNext();
               while(current != null) {
                          
                  if(current.getNext() != null && current.getNext().getPosition()-current.getPosition() > 100000) {
        System.out.println(current.getPosition() +" " +(current.getNext().getPosition()-current.getPosition()));
                  }
                  current = current.getNext();
               }
               current = null;
           }
           */
    } else if (keyCode == KeyEvent.VK_DELETE) {
        if (Main.drawCanvas.selectedSample != null) {
            Main.drawCanvas.removeSample(Main.drawCanvas.selectedSample);
        }
    }
    /*   else if(keyCode == KeyEvent.VK_7) {
                  
                  
       }*/
    else if (keyCode == KeyEvent.VK_O && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) {
        /*   clearData();
                   
           try {
              FileInputStream fin = new FileInputStream("C:/HY-Data/RKATAINE/test.ses");
              ObjectInputStream ois = new ObjectInputStream(fin);
              drawCanvas.sampleList = (ArrayList<Sample>) ois.readObject();
              Main.samples = (short)drawCanvas.sampleList.size();
                      
              drawCanvas.splits = (ArrayList<SplitClass>) ois.readObject();
              for(int i = 0; i<drawCanvas.splits.size(); i++) {
                 drawCanvas.splits.get(i).resetSplits();
              }
              drawCanvas.drawVariables = (DrawVariables)ois.readObject();
                      
              ois.close();
              drawCanvas.resizeCanvas(Main.drawCanvas.getWidth(), Main.drawCanvas.getHeight());
                      
              Draw.setScrollbar(drawCanvas.drawVariables.scrollbarpos);
                      
              for(int i= 0; i<drawCanvas.splits.size(); i++) {
                 drawCanvas.splits.get(i).setCytoImage(null);
                 chromDraw.drawCyto(drawCanvas.splits.get(i));
                 chromDraw.updateExons = true;
                 FileRead.search = true;
                 drawCanvas.gotoPos(drawCanvas.splits.get(i).chrom, drawCanvas.splits.get(i).start, drawCanvas.splits.get(i).end);
                 chromDraw.repaint();
              }
              for(int i = 0 ;i<drawCanvas.sampleList.size(); i++) {
                 for(int r = 0 ;r<drawCanvas.sampleList.size(); r++) {
                    if(drawCanvas.sampleList.get(i).getreadHash().size() > 0) {
          drawCanvas.sampleList.get(i).resetreadHash();
                    }
                 }
              }
                   
           }
           catch(Exception ex) {
              ex.printStackTrace();
           }
           */
    }

    else if (keyCode == KeyEvent.VK_F9) {

        FileRead.head.putNext(null);
        drawCanvas.variantsStart = 0;
        drawCanvas.variantsEnd = 1;
        Draw.updatevars = true;
        Main.drawCanvas.repaint();

    } else if (keyCode == KeyEvent.VK_F11) {

        /*   try {
              BBFileReader reader = new BBFileReader( Main.bedCanvas.bedTrack.get(0).file.getCanonicalPath(),  Main.bedCanvas.bedTrack.get(0));
              int zoomlevel = 1;
              for(int i =2;i<reader.getZoomLevels().getZoomHeaderCount();i++) {
                 if(reader.getZoomLevels().getZoomLevelHeader(i).getReductionLevel() < (Main.drawCanvas.splits.get(0).viewLength/(Main.drawCanvas.splits.get(0).pixel*Main.drawCanvas.splits.get(0).viewLength))) {
                    zoomlevel = i;
                 }
                 else {
                    break;
                 }
              }
                      
                
                         
           }
           catch(Exception ex) {
              ex.printStackTrace();
           }*/
    } else if (keyCode == KeyEvent.VK_F12) {
        /*VarNode next = Main.drawCanvas.current.getNext();
                
        MethodLibrary.makeMultiAlt("2",next.getPosition(), "G", next);
                
           next = null;
        */
        /*   try {
              URL urli = new URL("ftp://ftp.ensembl.org/pub/grch37/update/gff3/homo_sapiens/Homo_sapiens.GRCh37.87.gff3.gz");
              System.out.println(urli.getProtocol() +" " +urli.getHost() +" " +urli.getPath().substring(0,urli.getPath().lastIndexOf("/")+1));
           }
           catch(Exception ex) {
              ex.printStackTrace();
           }*/
    } else if (keyCode == KeyEvent.VK_F8) {

        File file = new File(searchField.getText().replaceAll(" ", ""));
        if (!file.exists()) {
            if (Main.drawCanvas.splits.get(0).viewLength < 1000) {

                Main.getConsSeq();
            }
        } else {
            try {
                /*
                JFileChooser chooser = new JFileChooser(file.getPath());
                chooser.setAcceptAllFileFilterUsed(true);                       
                        
                chooser.setDialogTitle("Save FASTA file as...");
                int returnVal = chooser.showSaveDialog((Component)this.getParent());                   
                        
                if(returnVal == JFileChooser.APPROVE_OPTION) {  
                  String suffix = "";
                  if(!chooser.getSelectedFile().getName().endsWith(".fa") && !chooser.getSelectedFile().getName().endsWith(".fasta")) {
                     suffix = ".fa";
                  }
                          
                   File outfile = new File(chooser.getSelectedFile().getCanonicalPath() +suffix);   
                 //  File outfile = new File("test.fa");   
                   Main.nothread = true;
                  Main.noreadthread = true;
                  FileRead.search = true;   
                  Draw.variantcalculator = true;
                        
                  Seqfetcher fetcher = new Seqfetcher(file, outfile);
                  fetcher.execute();
                           
                }*/
            } catch (Exception ex) {
                ex.printStackTrace();
            }

        }

    } else if (keyCode == KeyEvent.VK_ENTER) {

        if (e.getSource() == searchField) {
            search(searchField.getText());

        }

    }

}