Example usage for java.awt.event KeyEvent consume

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

Introduction

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

Prototype

public void consume() 

Source Link

Document

Consumes this event so that it will not be processed in the default manner by the source which originated it.

Usage

From source file:org.kalypso.ogc.gml.map.widgets.MeasureMapWidget.java

@Override
public void keyPressed(final KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_SPACE) {
        e.consume();

        final int currentIndex = ArrayUtils.indexOf(m_delegates, m_delegate);
        final int newIndex = (currentIndex + 1) % m_delegates.length;
        updateDelegate(newIndex);/*from w w w  . j  av a2  s  .co m*/

        getMapPanel().repaintMap();
        return;
    }

    if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
        e.consume();

        reset();
        getMapPanel().repaintMap();
        return;
    }

    super.keyPressed(e);
}

From source file:GeneradorLenguaje.java

private void txt_nKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_nKeyTyped
    // TODO add your handling code here:
    char a = evt.getKeyChar();
    if (a < '0' || a > '9') {
        evt.consume();
    }//  w w  w  .  ja  v  a  2  s  .c o m
}

From source file:GeneradorLenguaje.java

private void txt_iKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_iKeyTyped
    // TODO add your handling code here:
    char a = evt.getKeyChar();
    if (a < '0' || a > '9') {
        evt.consume();
    }//from w w w . j  a  v a2s.c o m
}

From source file:ja.lingo.application.gui.main.settings.dictionaries.add.AddPanel.java

public void onReaderListKeyPressed(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_ENTER && !fileChooser.hasSelectedFile()) {
        fileChooser.askForFile();//from  w  w w .ja  v a  2 s .c  o m
        e.consume();
    }
}

From source file:org.boaboa.vistas.FormularioVenta.java

/**
 * Creates new form FormularioVenta//from   ww w . ja v  a 2s.  c  om
 */
public void Nletras(JTextField a) {
    a.addKeyListener(new KeyAdapter() {
        public void keyTyped(KeyEvent e) {
            char c = e.getKeyChar();
            if (!Character.isDigit(c)) {
                e.consume();
            }
        }
    });
}

From source file:com.mirth.connect.client.ui.components.KeyStrokeTextField.java

@Override
public void keyTyped(KeyEvent evt) {
    if (keyCode != null && (evt.getKeyCode() == KeyEvent.VK_ENTER || evt.getKeyCode() == KeyEvent.VK_ESCAPE)) {
        return;/*  ww w .  ja  v a2 s  . c o m*/
    }

    // Clear the text field if backspace is pressed
    if (evt.getKeyCode() == KeyEvent.VK_BACK_SPACE || evt.getKeyChar() == '\b') {
        reset();
        PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
    }
    evt.consume();
}

From source file:PruebaMixto.java

private void txt_gKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_gKeyTyped

    char a = evt.getKeyChar();
    if (a < '0' || a > '9') {
        evt.consume();
    } // TODO add your handling code here:
}

From source file:PruebaMixto.java

private void txt_kKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_kKeyTyped

    char a = evt.getKeyChar();
    if (a < '0' || a > '9') {
        evt.consume();
    } // TODO add your handling code here:
}

From source file:finalproject.BloodGlucoseGUI.java

/**
 * Constructor//from   w w w.  ja  va2  s. c  om
 * Creates new form BloodGlucoseGUI
 */
// I would put most of it in initComponents if I could 
// edit that generated code.
public BloodGlucoseGUI() {
    initComponents();
    //jfc = new JFileChooser("Resources/Data");

    // For "commercial" use
    //jfc = new JFileChooser("C:\\Program Files\\BGDataAnalysis\\Data");
    jfc = new JFileChooser("C:\\BGDataAnalysis\\Data");

    tabMod = new MyTableModel();
    jTable2.setModel(tabMod);

    listMod = new DefaultListModel();
    jList1.setModel(listMod);

    JTableHeader th = jTable2.getTableHeader();
    TableColumnModel tcm = th.getColumnModel();
    TableColumn tc = tcm.getColumn(0);
    tc.setHeaderValue("Time");
    tc = tcm.getColumn(1);
    tc.setHeaderValue("Blood Glucose");
    th.repaint();

    notesTextArea.setLineWrap(true);
    notesTextArea.setWrapStyleWord(true);

    notesTextArea.addKeyListener(new KeyAdapter() {
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                e.consume();

                ErrorGUIs.Popup pu = new ErrorGUIs.Popup();
                pu.add("Please don't press the ENTER button!");
                pu.display();
            }
        }
    });
}

From source file:Console.java

public void keyTyped(KeyEvent e) {
    int keyChar = e.getKeyChar();
    if (keyChar == 0x8 /* KeyEvent.VK_BACK_SPACE */) {
        if (outputMark == getCaretPosition()) {
            e.consume();
        }// ww w .  j av  a  2 s .  c  om
    } else if (getCaretPosition() < outputMark) {
        setCaretPosition(outputMark);
    }
}