Example usage for java.awt.event KeyEvent KeyEvent

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

Introduction

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

Prototype

@Deprecated
public KeyEvent(Component source, int id, long when, int modifiers, int keyCode) 

Source Link

Usage

From source file:fs.MainWindow.java

private void jButton35ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton35ActionPerformed
    dispatchEvent(new KeyEvent(this, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_F1));
}

From source file:fs.MainWindow.java

private void jButton34ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton34ActionPerformed
    dispatchEvent(new KeyEvent(this, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_F1));
}

From source file:fs.MainWindow.java

private void jButton33ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton33ActionPerformed
    dispatchEvent(new KeyEvent(this, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_F1));
}

From source file:fs.MainWindow.java

private void jButton32ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton32ActionPerformed
    dispatchEvent(new KeyEvent(this, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_F1));
}

From source file:org.nuclos.client.ui.collect.SubForm.java

/**
 * create an Tablecelleditor for the given component
 * @param clctcomp//from w w w.  ja  v a  2s .c om
 * @return the newly created table cell editor
 */
private CollectableComponentTableCellEditor createTableCellEditor(final CollectableComponent clctcomp) {
    if (getColumn(clctcomp.getFieldName()) != null) {
        final Map<String, Object> properties = getColumn(clctcomp.getFieldName()).getProperties();
        for (String property : properties.keySet()) {
            clctcomp.setProperty(property, properties.get(property));
        }
    }
    final CollectableComponentTableCellEditor result = new CollectableComponentTableCellEditor(clctcomp,
            clctcomp.isSearchComponent());

    result.addCollectableComponentModelListener(getCollectableTableCellEditorChangeListener());

    // @see NUCLOS-603. checkboxes and options should setvalue directly.
    if (clctcomp instanceof CollectableCheckBox) {
        ((CollectableCheckBox) clctcomp).getJCheckBox().addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                SwingUtilities.invokeLater(new Runnable() { //@see NUCLOSINT-1635
                    public void run() {
                        try {
                            if (getSubformTable().getModel() instanceof SubFormTableModel) {
                                int row = getSubformTable().getSelectedRow();
                                int column = ((SubFormTableModel) getSubformTable().getModel())
                                        .findColumnByFieldName(clctcomp.getFieldName());
                                if (row != -1 && column != -1) {
                                    if (getSubformTable().getModel() instanceof SearchConditionTableModel)
                                        getSubformTable().setValueAt(clctcomp.getSearchCondition(), row,
                                                column);
                                    else
                                        getSubformTable().setValueAt(clctcomp.getField(), row, column);
                                }
                            }
                        } catch (CollectableFieldFormatException e1) {
                            LOG.warn("could not set value for " + clctcomp.getFieldName(), e1);
                        }
                    }
                });
            }
        });
    }
    if (clctcomp instanceof CollectableOptionGroup) {
        ((CollectableOptionGroup) clctcomp).getOptionGroup().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    if (getSubformTable().getModel() instanceof SubFormTableModel) {
                        int row = getSubformTable().getSelectedRow();
                        int column = ((SubFormTableModel) getSubformTable().getModel())
                                .findColumnByFieldName(clctcomp.getFieldName());
                        if (row != -1 && column != -1)
                            getSubformTable().setValueAt(clctcomp.getField(), row, column);
                    }

                } catch (CollectableFieldFormatException e1) {
                    LOG.warn("could not set value for " + clctcomp.getFieldName(), e1);
                }
            }
        });
    }

    // textarea have to handle Tab in an subform differently.
    if (clctcomp instanceof NuclosCollectableTextArea) {
        ((NuclosCollectableTextArea) clctcomp).overrideActionMap(new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent evt) {
                Component c = (Component) ((NuclosCollectableTextArea) clctcomp).getJTextArea().getParent();
                c.dispatchEvent(
                        new KeyEvent(c, KeyEvent.KEY_PRESSED, System.currentTimeMillis(), 0, KeyEvent.VK_TAB));
            }
        }, new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent evt) {
                Component c = (Component) ((NuclosCollectableTextArea) clctcomp).getJTextArea().getParent();
                c.dispatchEvent(new KeyEvent(c, KeyEvent.KEY_PRESSED, System.currentTimeMillis(),
                        KeyEvent.SHIFT_MASK, KeyEvent.VK_TAB));
            }
        });
    }
    if (clctcomp instanceof DynamicRowHeightChangeProvider) {
        ((DynamicRowHeightChangeProvider) clctcomp).addDynamicRowHeightChangeListener(this);
    }

    return result;
}