Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6459860

keyPressed/keyReleased sequence for should be documented

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Understanding:
      Cause Known
    • CPU:
      x86
    • OS:
      linux

      Description

      FULL PRODUCT VERSION :
      1.5.0_07

      ADDITIONAL OS VERSION INFORMATION :
      Linux kernel 2.6.12 Debian Box.

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      KDE 3.5

      A DESCRIPTION OF THE PROBLEM :
      The Bug consists in capture the VK_UP or VK_DOWN on keyReleased inside addKeyListner... the Bug is very simple to reproduce...

      The VK_UP event , must occurs if the user release the holded key... in Windows... this work perfect... in linux... the event is called line by line of JTable...

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Press the DOWN button and HOLD THEM...

      the event must called ONLY AFTER YOU RELEASE THE DOWN BUTTON.... , but in linux...the event is called line by line...

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The event only call on release the UP buytton... but this event is called line by line on JTable (if in linux , in windows work perfect! )
      ACTUAL -
      Line by line the event is called...

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      /*
       * NewJFrame.java
       *
       * Created on 3 de Agosto de 2006, 15:55
       */

      package swingtest;

      import java.awt.event.KeyAdapter;
      import java.awt.event.KeyEvent;
      import javax.swing.JOptionPane;

      /**
       *
       * @author root
       */
      public class NewJFrame extends javax.swing.JFrame {
          
          /** Creates new form NewJFrame */
          public NewJFrame() {
              initComponents();
              
               jTable1.addKeyListener(new KeyAdapter() {
                  public void keyReleased(KeyEvent e) {
                      if (e.getKeyCode() == KeyEvent.VK_UP) {
                          JOptionPane.showMessageDialog(NewJFrame.this,"up !");
                      }else
                      if (e.getKeyCode() == KeyEvent.VK_DOWN) {
                          JOptionPane.showMessageDialog(NewJFrame.this,"Down !");
                      }
                  }
              });

          }
          
          /** This method is called from within the constructor to
           * initialize the form.
           * WARNING: Do NOT modify this code. The content of this method is
           * always regenerated by the Form Editor.
           */
          // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
          private void initComponents() {
              jScrollPane1 = new javax.swing.JScrollPane();
              jTable1 = new javax.swing.JTable();

              setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
              jTable1.setModel(new javax.swing.table.DefaultTableModel(
                  new Object [][] {
                      {null, null, null, null},
                      {null, null, null, null},
                      {null, null, null, null},
                      {null, null, null, null}
                  },
                  new String [] {
                      "Title 1", "Title 2", "Title 3", "Title 4"
                  }
              ));
              jScrollPane1.setViewportView(jTable1);
              getContentPane().add(jTable1);

      /*
              org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
              getContentPane().setLayout(layout);
              layout.setHorizontalGroup(
                  layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                  .add(layout.createSequentialGroup()
                      .addContainerGap()
                      .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 375, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                      .addContainerGap(13, Short.MAX_VALUE))
              );
              layout.setVerticalGroup(
                  layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                  .add(layout.createSequentialGroup()
                      .addContainerGap()
                      .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 275, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                      .addContainerGap(13, Short.MAX_VALUE))
              );
      */
              pack();
          }// </editor-fold>
          
          /**
           * @param args the command line arguments
           */
          public static void main(String args[]) {
              java.awt.EventQueue.invokeLater(new Runnable() {
                  public void run() {
                      new NewJFrame().setVisible(true);
                  }
              });
          }
          
          // Variables declaration - do not modify
          private javax.swing.JScrollPane jScrollPane1;
          private javax.swing.JTable jTable1;
          // End of variables declaration
          
      }

      ---------- END SOURCE ----------

        Attachments

          Activity

            People

            Assignee:
            yan Yuri Nesterenko
            Reporter:
            dav Andrei Dmitriev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Imported:
              Indexed: