< prev index next >

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

Print this page


   1 /*
   2  * Copyright (c) 1997, 2020, 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


3300 
3301             public AccessibleRole getAccessibleRole() {
3302                 AccessibleContext ac = getCurrentAccessibleContext();
3303                 if (ac != null) {
3304                     return ac.getAccessibleRole();
3305                 } else {
3306                     return null;
3307                 }
3308             }
3309 
3310             public AccessibleStateSet getAccessibleStateSet() {
3311                 AccessibleContext ac = getCurrentAccessibleContext();
3312                 AccessibleStateSet s;
3313                 if (ac != null) {
3314                     s = ac.getAccessibleStateSet();
3315                 } else {
3316                     s = new AccessibleStateSet();
3317                 }
3318 
3319                 s.add(AccessibleState.SELECTABLE);
3320                 s.add(AccessibleState.VISIBLE);
3321                 if (parent.isFocusOwner()
3322                     && (indexInParent == parent.getLeadSelectionIndex())) {
3323                     s.add(AccessibleState.ACTIVE);
3324                 }
3325                 if (parent.isSelectedIndex(indexInParent)) {
3326                     s.add(AccessibleState.SELECTED);
3327                 }
3328                 if (this.isShowing()) {
3329                     s.add(AccessibleState.SHOWING);
3330                 } else if (s.contains(AccessibleState.SHOWING)) {
3331                     s.remove(AccessibleState.SHOWING);





3332                 }
3333                 s.add(AccessibleState.TRANSIENT); // cell-rendered
3334                 return s;
3335             }
3336 
3337             public int getAccessibleIndexInParent() {
3338                 return indexInParent;
3339             }
3340 
3341             public int getAccessibleChildrenCount() {
3342                 AccessibleContext ac = getCurrentAccessibleContext();
3343                 if (ac != null) {
3344                     return ac.getAccessibleChildrenCount();
3345                 } else {
3346                     return 0;
3347                 }
3348             }
3349 
3350             public Accessible getAccessibleChild(int i) {
3351                 AccessibleContext ac = getCurrentAccessibleContext();


   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


3300 
3301             public AccessibleRole getAccessibleRole() {
3302                 AccessibleContext ac = getCurrentAccessibleContext();
3303                 if (ac != null) {
3304                     return ac.getAccessibleRole();
3305                 } else {
3306                     return null;
3307                 }
3308             }
3309 
3310             public AccessibleStateSet getAccessibleStateSet() {
3311                 AccessibleContext ac = getCurrentAccessibleContext();
3312                 AccessibleStateSet s;
3313                 if (ac != null) {
3314                     s = ac.getAccessibleStateSet();
3315                 } else {
3316                     s = new AccessibleStateSet();
3317                 }
3318 
3319                 s.add(AccessibleState.SELECTABLE);

3320                 if (parent.isFocusOwner()
3321                     && (indexInParent == parent.getLeadSelectionIndex())) {
3322                     s.add(AccessibleState.ACTIVE);
3323                 }
3324                 if (parent.isSelectedIndex(indexInParent)) {
3325                     s.add(AccessibleState.SELECTED);
3326                 }
3327                 if (this.isShowing()) {
3328                     s.add(AccessibleState.SHOWING);
3329                 } else if (s.contains(AccessibleState.SHOWING)) {
3330                     s.remove(AccessibleState.SHOWING);
3331                 }
3332                 if (this.isVisible()) {
3333                     s.add(AccessibleState.VISIBLE);
3334                 } else if (s.contains(AccessibleState.VISIBLE)) {
3335                     s.remove(AccessibleState.VISIBLE);
3336                 }
3337                 s.add(AccessibleState.TRANSIENT); // cell-rendered
3338                 return s;
3339             }
3340 
3341             public int getAccessibleIndexInParent() {
3342                 return indexInParent;
3343             }
3344 
3345             public int getAccessibleChildrenCount() {
3346                 AccessibleContext ac = getCurrentAccessibleContext();
3347                 if (ac != null) {
3348                     return ac.getAccessibleChildrenCount();
3349                 } else {
3350                     return 0;
3351                 }
3352             }
3353 
3354             public Accessible getAccessibleChild(int i) {
3355                 AccessibleContext ac = getCurrentAccessibleContext();


< prev index next >