Logo Search packages:      
Sourcecode: octave-java version File versions  Download package

void org::octave::DlgListener::keyPressed ( KeyEvent  e ) [inline]
Parameters:
eKeyEvent

Definition at line 113 of file DlgListener.java.

   {
      if ( e.getSource ().getClass ().equals ( JTextArea.class ) )
      {
         JTextArea ta = ( JTextArea ) e.getSource ();
         if ( e.getKeyCode () == KeyEvent.VK_ENTER )
         {
            char c[] = ta.getText ().toCharArray ();
            int nLines = 1;
            for ( int i = 0; i < c.length; i++ )
            {
               if ( c[i] == '\n' )
               {
                  nLines++;
               }
            }

            if ( nLines >= ta.getRows () )
            {
               e.consume ();
            }
         }
         else if ( e.getKeyCode () == KeyEvent.VK_TAB )
         {
            e.consume ();

            if ( ( e.getModifiersEx () & KeyEvent.SHIFT_DOWN_MASK ) ==
                 KeyEvent.SHIFT_DOWN_MASK )
            {
               ta.transferFocusBackward();
            }
            else
            {
               ta.transferFocus ();
            }
         }
      }
   }

Generated by  Doxygen 1.6.0   Back to index