< prev index next >

src/java.desktop/share/classes/javax/swing/JComponent.java

Print this page


   1 /*
   2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


3444             }
3445         }
3446 
3447         // We don't allow any values to be added.
3448         public void putValue(String key, Object value) {}
3449 
3450         // Does nothing, our enabledness is determiend from our asociated
3451         // action.
3452         public void setEnabled(boolean b) { }
3453 
3454         public void addPropertyChangeListener
3455                     (PropertyChangeListener listener) {}
3456         public void removePropertyChangeListener
3457                           (PropertyChangeListener listener) {}
3458     }
3459 
3460 
3461     // This class is used by the KeyboardState class to provide a single
3462     // instance that can be stored in the AppContext.
3463     static final class IntVector {
3464         int array[] = null;
3465         int count = 0;
3466         int capacity = 0;
3467 
3468         int size() {
3469             return count;
3470         }
3471 
3472         int elementAt(int index) {
3473             return array[index];
3474         }
3475 
3476         void addElement(int value) {
3477             if (count == capacity) {
3478                 capacity = (capacity + 2) * 2;
3479                 int[] newarray = new int[capacity];
3480                 if (count > 0) {
3481                     System.arraycopy(array, 0, newarray, 0, count);
3482                 }
3483                 array = newarray;
3484             }


   1 /*
   2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


3444             }
3445         }
3446 
3447         // We don't allow any values to be added.
3448         public void putValue(String key, Object value) {}
3449 
3450         // Does nothing, our enabledness is determiend from our asociated
3451         // action.
3452         public void setEnabled(boolean b) { }
3453 
3454         public void addPropertyChangeListener
3455                     (PropertyChangeListener listener) {}
3456         public void removePropertyChangeListener
3457                           (PropertyChangeListener listener) {}
3458     }
3459 
3460 
3461     // This class is used by the KeyboardState class to provide a single
3462     // instance that can be stored in the AppContext.
3463     static final class IntVector {
3464         int[] array = null;
3465         int count = 0;
3466         int capacity = 0;
3467 
3468         int size() {
3469             return count;
3470         }
3471 
3472         int elementAt(int index) {
3473             return array[index];
3474         }
3475 
3476         void addElement(int value) {
3477             if (count == capacity) {
3478                 capacity = (capacity + 2) * 2;
3479                 int[] newarray = new int[capacity];
3480                 if (count > 0) {
3481                     System.arraycopy(array, 0, newarray, 0, count);
3482                 }
3483                 array = newarray;
3484             }


< prev index next >